summaryrefslogtreecommitdiff
path: root/render/form.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
committerVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
commitc105738fa36bb2400adc47399c5b878d252d1c86 (patch)
tree138eeb449e1bf51ee1726b5f820740aada0ccd0b /render/form.c
parent20f2c86a511f7913cf858e7bd3668b0b59663ba0 (diff)
downloadnetsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.gz
netsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.bz2
Change LOG() macro to be varadic
This changes the LOG macro to be varadic removing the need for all callsites to have double bracketing and allows for future improvement on how we use the logging macros. The callsites were changed with coccinelle and the changes checked by hand. Compile tested for several frontends but not all. A formatting annotation has also been added which allows the compiler to check the parameters and types passed to the logging.
Diffstat (limited to 'render/form.c')
-rw-r--r--render/form.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/render/form.c b/render/form.c
index 34029df44..16bf5bbb7 100644
--- a/render/form.c
+++ b/render/form.c
@@ -218,7 +218,7 @@ void form_free_control(struct form_control *control)
struct form_control *c;
assert(control != NULL);
- LOG(("Control:%p name:%p value:%p initial:%p", control, control->name, control->value, control->initial_value));
+ LOG("Control:%p name:%p value:%p initial:%p", control, control->name, control->value, control->initial_value);
free(control->name);
free(control->value);
free(control->initial_value);
@@ -229,7 +229,7 @@ void form_free_control(struct form_control *control)
for (option = control->data.select.items; option;
option = next) {
next = option->next;
- LOG(("select option:%p text:%p value:%p", option, option->text, option->value));
+ LOG("select option:%p text:%p value:%p", option, option->text, option->value);
free(option->text);
free(option->value);
free(option);
@@ -346,7 +346,7 @@ bool form_successful_controls_dom(struct form *_form,
/** \todo Replace this call with something DOMish */
charset = form_acceptable_charset(_form);
if (charset == NULL) {
- LOG(("failed to find charset"));
+ LOG("failed to find charset");
return false;
}
@@ -360,7 +360,7 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_form_element_get_elements(form, &form_elements);
if (err != DOM_NO_ERR) {
- LOG(("Could not get form elements"));
+ LOG("Could not get form elements");
goto dom_no_memory;
}
@@ -368,7 +368,7 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_collection_get_length(form_elements, &element_count);
if (err != DOM_NO_ERR) {
- LOG(("Could not get form element count"));
+ LOG("Could not get form element count");
goto dom_no_memory;
}
@@ -400,7 +400,7 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_collection_item(form_elements,
index, &form_element);
if (err != DOM_NO_ERR) {
- LOG(("Could not retrieve form element %d", index));
+ LOG("Could not retrieve form element %d", index);
goto dom_no_memory;
}
@@ -412,7 +412,7 @@ bool form_successful_controls_dom(struct form *_form,
*/
err = dom_node_get_node_name(form_element, &nodename);
if (err != DOM_NO_ERR) {
- LOG(("Could not get node name"));
+ LOG("Could not get node name");
goto dom_no_memory;
}
@@ -421,14 +421,14 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_text_area_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG(("Could not get text area disabled property"));
+ LOG("Could not get text area disabled property");
goto dom_no_memory;
}
err = dom_html_text_area_element_get_name(
(dom_html_text_area_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG(("Could not get text area name property"));
+ LOG("Could not get text area name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_SELECT)) {
@@ -436,14 +436,14 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_select_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG(("Could not get select disabled property"));
+ LOG("Could not get select disabled property");
goto dom_no_memory;
}
err = dom_html_select_element_get_name(
(dom_html_select_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG(("Could not get select name property"));
+ LOG("Could not get select name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_INPUT)) {
@@ -451,14 +451,14 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG(("Could not get input disabled property"));
+ LOG("Could not get input disabled property");
goto dom_no_memory;
}
err = dom_html_input_element_get_name(
(dom_html_input_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG(("Could not get input name property"));
+ LOG("Could not get input name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_BUTTON)) {
@@ -466,21 +466,21 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG(("Could not get button disabled property"));
+ LOG("Could not get button disabled property");
goto dom_no_memory;
}
err = dom_html_button_element_get_name(
(dom_html_button_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG(("Could not get button name property"));
+ LOG("Could not get button name property");
goto dom_no_memory;
}
} else {
/* Unknown element type came through! */
- LOG(("Unknown element type: %*s",
- dom_string_byte_length(nodename),
- dom_string_data(nodename)));
+ LOG("Unknown element type: %*s",
+ (int)dom_string_byte_length(nodename),
+ dom_string_data(nodename));
goto dom_no_memory;
}
if (element_disabled)
@@ -493,7 +493,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_text_area_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG(("Could not get text area content"));
+ LOG("Could not get text area content");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_SELECT)) {
@@ -502,13 +502,13 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_select_element *)form_element,
&options);
if (err != DOM_NO_ERR) {
- LOG(("Could not get select options collection"));
+ LOG("Could not get select options collection");
goto dom_no_memory;
}
err = dom_html_options_collection_get_length(
options, &options_count);
if (err != DOM_NO_ERR) {
- LOG(("Could not get select options collection length"));
+ LOG("Could not get select options collection length");
goto dom_no_memory;
}
for(option_index = 0; option_index < options_count;
@@ -525,14 +525,14 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_options_collection_item(
options, option_index, &option_element);
if (err != DOM_NO_ERR) {
- LOG(("Could not get options item %d", option_index));
+ LOG("Could not get options item %d", option_index);
goto dom_no_memory;
}
err = dom_html_option_element_get_selected(
(dom_html_option_element *)option_element,
&selected);
if (err != DOM_NO_ERR) {
- LOG(("Could not get option selected property"));
+ LOG("Could not get option selected property");
goto dom_no_memory;
}
if (!selected)
@@ -541,13 +541,13 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_option_element *)option_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG(("Could not get option value"));
+ LOG("Could not get option value");
goto dom_no_memory;
}
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
- LOG(("Could not allocate data for option"));
+ LOG("Could not allocate data for option");
goto dom_no_memory;
}
@@ -556,12 +556,12 @@ bool form_successful_controls_dom(struct form *_form,
success_new->name = ENCODE_ITEM(inputname);
if (success_new->name == NULL) {
- LOG(("Could not encode name for option"));
+ LOG("Could not encode name for option");
goto dom_no_memory;
}
success_new->value = ENCODE_ITEM(inputvalue);
if (success_new->value == NULL) {
- LOG(("Could not encode value for option"));
+ LOG("Could not encode value for option");
goto dom_no_memory;
}
}
@@ -571,7 +571,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *) form_element,
&inputtype);
if (err != DOM_NO_ERR) {
- LOG(("Could not get button element type"));
+ LOG("Could not get button element type");
goto dom_no_memory;
}
if (dom_string_caseless_isequal(
@@ -591,7 +591,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG(("Could not get submit button value"));
+ LOG("Could not get submit button value");
goto dom_no_memory;
}
/* Drop through to report successful button */
@@ -608,7 +608,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *) form_element,
&inputtype);
if (err != DOM_NO_ERR) {
- LOG(("Could not get input element type"));
+ LOG("Could not get input element type");
goto dom_no_memory;
}
if (dom_string_caseless_isequal(
@@ -628,7 +628,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG(("Could not get submit button value"));
+ LOG("Could not get submit button value");
goto dom_no_memory;
}
/* Drop through to report the successful button */
@@ -646,11 +646,11 @@ bool form_successful_controls_dom(struct form *_form,
corestring_dom___ns_key_image_coords_node_data,
&coords);
if (err != DOM_NO_ERR) {
- LOG(("Could not get image XY data"));
+ LOG("Could not get image XY data");
goto dom_no_memory;
}
if (coords == NULL) {
- LOG(("No XY data on the image input"));
+ LOG("No XY data on the image input");
goto dom_no_memory;
}
@@ -659,7 +659,7 @@ bool form_successful_controls_dom(struct form *_form,
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
free(basename);
- LOG(("Could not allocate data for image.x"));
+ LOG("Could not allocate data for image.x");
goto dom_no_memory;
}
@@ -669,13 +669,13 @@ bool form_successful_controls_dom(struct form *_form,
success_new->name = malloc(strlen(basename) + 3);
if (success_new->name == NULL) {
free(basename);
- LOG(("Could not allocate name for image.x"));
+ LOG("Could not allocate name for image.x");
goto dom_no_memory;
}
success_new->value = malloc(20);
if (success_new->value == NULL) {
free(basename);
- LOG(("Could not allocate value for image.x"));
+ LOG("Could not allocate value for image.x");
goto dom_no_memory;
}
sprintf(success_new->name, "%s.x", basename);
@@ -684,7 +684,7 @@ bool form_successful_controls_dom(struct form *_form,
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
free(basename);
- LOG(("Could not allocate data for image.y"));
+ LOG("Could not allocate data for image.y");
goto dom_no_memory;
}
@@ -694,13 +694,13 @@ bool form_successful_controls_dom(struct form *_form,
success_new->name = malloc(strlen(basename) + 3);
if (success_new->name == NULL) {
free(basename);
- LOG(("Could not allocate name for image.y"));
+ LOG("Could not allocate name for image.y");
goto dom_no_memory;
}
success_new->value = malloc(20);
if (success_new->value == NULL) {
free(basename);
- LOG(("Could not allocate value for image.y"));
+ LOG("Could not allocate value for image.y");
goto dom_no_memory;
}
sprintf(success_new->name, "%s.y", basename);
@@ -715,7 +715,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&checked);
if (err != DOM_NO_ERR) {
- LOG(("Could not get input element checked"));
+ LOG("Could not get input element checked");
goto dom_no_memory;
}
if (!checked)
@@ -724,7 +724,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG(("Could not get input element value"));
+ LOG("Could not get input element value");
goto dom_no_memory;
}
if (inputvalue == NULL) {
@@ -739,7 +739,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG(("Could not get file value"));
+ LOG("Could not get file value");
goto dom_no_memory;
}
err = dom_node_get_user_data(
@@ -747,14 +747,14 @@ bool form_successful_controls_dom(struct form *_form,
corestring_dom___ns_key_file_name_node_data,
&rawfile_temp);
if (err != DOM_NO_ERR) {
- LOG(("Could not get file rawname"));
+ LOG("Could not get file rawname");
goto dom_no_memory;
}
rawfile_temp = strdup(rawfile_temp != NULL ?
rawfile_temp :
"");
if (rawfile_temp == NULL) {
- LOG(("Could not copy file rawname"));
+ LOG("Could not copy file rawname");
goto dom_no_memory;
}
/* Fall out to the allocation */
@@ -763,7 +763,7 @@ bool form_successful_controls_dom(struct form *_form,
dom_string_caseless_isequal(
inputtype, corestring_dom_button)) {
/* Skip these */
- LOG(("Skipping RESET and BUTTON"));
+ LOG("Skipping RESET and BUTTON");
continue;
} else {
/* Everything else is treated as text values */
@@ -771,7 +771,7 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG(("Could not get input value"));
+ LOG("Could not get input value");
goto dom_no_memory;
}
/* Fall out to the allocation */
@@ -780,7 +780,7 @@ bool form_successful_controls_dom(struct form *_form,
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
- LOG(("Could not allocate data for generic"));
+ LOG("Could not allocate data for generic");
goto dom_no_memory;
}
@@ -789,12 +789,12 @@ bool form_successful_controls_dom(struct form *_form,
success_new->name = ENCODE_ITEM(inputname);
if (success_new->name == NULL) {
- LOG(("Could not encode name for generic"));
+ LOG("Could not encode name for generic");
goto dom_no_memory;
}
success_new->value = ENCODE_ITEM(inputvalue);
if (success_new->value == NULL) {
- LOG(("Could not encode value for generic"));
+ LOG("Could not encode value for generic");
goto dom_no_memory;
}
if (rawfile_temp != NULL) {