projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix typo in CGI template comments
[privoxy.git]
/
cgiedit.c
diff --git
a/cgiedit.c
b/cgiedit.c
index
1443f6c
..
0ffa8bb
100644
(file)
--- a/
cgiedit.c
+++ b/
cgiedit.c
@@
-1,4
+1,4
@@
-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.8
2 2014/06/03 10:31:27
fabiankeil Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.8
7 2014/10/18 11:31:52
fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
@@
-843,11
+843,7
@@
jb_err edit_write_file(struct editable_file * file)
freez(file->version_str);
snprintf(version_buf, sizeof(version_buf), "%u", file->version);
version_buf[sizeof(version_buf)-1] = '\0';
freez(file->version_str);
snprintf(version_buf, sizeof(version_buf), "%u", file->version);
version_buf[sizeof(version_buf)-1] = '\0';
- file->version_str = strdup(version_buf);
- if (version_buf == NULL)
- {
- return JB_ERR_MEMORY;
- }
+ file->version_str = strdup_or_die(version_buf);
return JB_ERR_OK;
}
return JB_ERR_OK;
}
@@
-1223,14
+1219,7
@@
jb_err edit_parse_actions_file(struct editable_file * file)
return JB_ERR_PARSE;
}
return JB_ERR_PARSE;
}
- if ((new_alias = zalloc(sizeof(*new_alias))) == NULL)
- {
- /* Out of memory */
- free(name);
- free(value);
- free_alias_list(alias_list);
- return JB_ERR_MEMORY;
- }
+ new_alias = zalloc_or_die(sizeof(*new_alias));
err = get_actions(value, alias_list, new_alias->action);
if (err)
err = get_actions(value, alias_list, new_alias->action);
if (err)
@@
-1398,11
+1387,7
@@
jb_err edit_read_file_lines(FILE *fp, struct file_line ** pfile, int *newline)
*pfile = NULL;
*pfile = NULL;
- cur_line = first_line = zalloc(sizeof(struct file_line));
- if (cur_line == NULL)
- {
- return JB_ERR_MEMORY;
- }
+ cur_line = first_line = zalloc_or_die(sizeof(struct file_line));
cur_line->type = FILE_LINE_UNPROCESSED;
cur_line->type = FILE_LINE_UNPROCESSED;
@@
-1418,13
+1403,7
@@
jb_err edit_read_file_lines(FILE *fp, struct file_line ** pfile, int *newline)
do
{
prev_line = cur_line;
do
{
prev_line = cur_line;
- cur_line = prev_line->next = zalloc(sizeof(struct file_line));
- if (cur_line == NULL)
- {
- /* Out of memory */
- edit_free_file_lines(first_line);
- return JB_ERR_MEMORY;
- }
+ cur_line = prev_line->next = zalloc_or_die(sizeof(struct file_line));
cur_line->type = FILE_LINE_UNPROCESSED;
cur_line->type = FILE_LINE_UNPROCESSED;
@@
-1554,12
+1533,7
@@
jb_err edit_read_file(struct client_state *csp,
return err;
}
return err;
}
- file = (struct editable_file *) zalloc(sizeof(*file));
- if (err)
- {
- edit_free_file_lines(lines);
- return err;
- }
+ file = zalloc_or_die(sizeof(*file));
file->lines = lines;
file->newline = newline;
file->lines = lines;
file->newline = newline;
@@
-1571,12
+1545,7
@@
jb_err edit_read_file(struct client_state *csp,
freez(file->version_str);
snprintf(version_buf, sizeof(version_buf), "%u", file->version);
version_buf[sizeof(version_buf)-1] = '\0';
freez(file->version_str);
snprintf(version_buf, sizeof(version_buf), "%u", file->version);
version_buf[sizeof(version_buf)-1] = '\0';
- file->version_str = strdup(version_buf);
- if (version_buf == NULL)
- {
- edit_free_file(file);
- return JB_ERR_MEMORY;
- }
+ file->version_str = strdup_or_die(version_buf);
*pfile = file;
return JB_ERR_OK;
*pfile = file;
return JB_ERR_OK;
@@
-2351,7
+2320,7
@@
jb_err cgi_edit_actions_list(struct client_state *csp,
{
if (!strncmp(b->url->spec, "standard.", 9) && *(b->url->spec + 9) != '\0')
{
{
if (!strncmp(b->url->spec, "standard.", 9) && *(b->url->spec + 9) != '\0')
{
- if (err
|| (NULL == (section_exports = new_map()))
)
+ if (err)
{
freez(buttons);
free(section_template);
{
freez(buttons);
free(section_template);
@@
-2360,6
+2329,7
@@
jb_err cgi_edit_actions_list(struct client_state *csp,
return JB_ERR_MEMORY;
}
return JB_ERR_MEMORY;
}
+ section_exports = new_map();
err = map(section_exports, "button-name", 1, b->url->spec + 9, 1);
if (err || (NULL == (s = strdup(section_template))))
err = map(section_exports, "button-name", 1, b->url->spec + 9, 1);
if (err || (NULL == (s = strdup(section_template))))
@@
-2491,15
+2461,7
@@
jb_err cgi_edit_actions_list(struct client_state *csp,
while ((cur_line != NULL) && (cur_line->type == FILE_LINE_ACTION))
{
while ((cur_line != NULL) && (cur_line->type == FILE_LINE_ACTION))
{
- if (NULL == (section_exports = new_map()))
- {
- free(sections);
- free(section_template);
- free(url_template);
- edit_free_file(file);
- free_map(exports);
- return JB_ERR_MEMORY;
- }
+ section_exports = new_map();
snprintf(buf, sizeof(buf), "%u", line_number);
err = map(section_exports, "s", 1, buf, 1);
snprintf(buf, sizeof(buf), "%u", line_number);
err = map(section_exports, "s", 1, buf, 1);
@@
-2563,17
+2525,7
@@
jb_err cgi_edit_actions_list(struct client_state *csp,
while ((cur_line != NULL) && (cur_line->type == FILE_LINE_URL))
{
while ((cur_line != NULL) && (cur_line->type == FILE_LINE_URL))
{
- if (NULL == (url_exports = new_map()))
- {
- free(urls);
- free(sections);
- free(section_template);
- free(url_template);
- edit_free_file(file);
- free_map(exports);
- free_map(section_exports);
- return JB_ERR_MEMORY;
- }
+ url_exports = new_map();
snprintf(buf, sizeof(buf), "%u", line_number);
err = map(url_exports, "p", 1, buf, 1);
snprintf(buf, sizeof(buf), "%u", line_number);
err = map(url_exports, "p", 1, buf, 1);
@@
-3461,13
+3413,7
@@
jb_err cgi_edit_actions_add_url(struct client_state *csp,
/* At this point, the section header is in cur_line - add after this. */
/* Allocate the new line */
/* At this point, the section header is in cur_line - add after this. */
/* Allocate the new line */
- new_line = (struct file_line *)zalloc(sizeof(*new_line));
- if (new_line == NULL)
- {
- free(new_pattern);
- edit_free_file(file);
- return JB_ERR_MEMORY;
- }
+ new_line = zalloc_or_die(sizeof(*new_line));
/* Fill in the data members of the new line */
new_line->raw = NULL;
/* Fill in the data members of the new line */
new_line->raw = NULL;
@@
-3854,13
+3800,7
@@
jb_err cgi_edit_actions_section_add(struct client_state *csp,
}
/* Allocate the new line */
}
/* Allocate the new line */
- new_line = (struct file_line *)zalloc(sizeof(*new_line));
- if (new_line == NULL)
- {
- free(new_text);
- edit_free_file(file);
- return JB_ERR_MEMORY;
- }
+ new_line = zalloc_or_die(sizeof(*new_line));
/* Fill in the data members of the new line */
new_line->raw = NULL;
/* Fill in the data members of the new line */
new_line->raw = NULL;