summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-eval.c5
-rw-r--r--src/core/wee-string.c15
2 files changed, 11 insertions, 9 deletions
diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c
index ce64139e3..cdee2ec79 100644
--- a/src/core/wee-eval.c
+++ b/src/core/wee-eval.c
@@ -395,16 +395,13 @@ eval_replace_vars (const char *expr, struct t_hashtable *pointers,
struct t_hashtable *extra_vars,
const char *prefix, const char *suffix)
{
- int errors;
void *ptr[2];
ptr[0] = pointers;
ptr[1] = extra_vars;
return string_replace_with_callback (expr, prefix, suffix,
- &eval_replace_vars_cb,
- ptr,
- &errors);
+ &eval_replace_vars_cb, ptr, NULL);
}
/*
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index dc184b9ca..6d9af0ede 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -2641,7 +2641,8 @@ string_input_for_buffer (const char *string)
*
* Nested variables are supported, for example: "${var1:${var2}}".
*
- * Argument "errors" is set with number of keys not found by callback.
+ * Argument "errors" (if not NULL) is set with number of keys not found by
+ * callback.
*
* Note: result must be freed after use.
*/
@@ -2659,7 +2660,8 @@ string_replace_with_callback (const char *string,
char *result, *result2, *key, *key2, *value;
const char *pos_end_name;
- *errors = 0;
+ if (errors)
+ *errors = 0;
if (!string || !prefix || !prefix[0] || !suffix || !suffix[0] || !callback)
return NULL;
@@ -2710,7 +2712,8 @@ string_replace_with_callback (const char *string,
if (!pos_end_name[0])
{
result[index_result] = '\0';
- (*errors)++;
+ if (errors)
+ (*errors)++;
return result;
}
key = string_strndup (string + index_string + length_prefix,
@@ -2724,7 +2727,8 @@ string_replace_with_callback (const char *string,
suffix, callback,
callback_data,
&sub_errors);
- (*errors) += sub_errors;
+ if (errors)
+ (*errors) += sub_errors;
free (key);
key = key2;
}
@@ -2755,7 +2759,8 @@ string_replace_with_callback (const char *string,
else
{
result[index_result++] = string[index_string++];
- (*errors)++;
+ if (errors)
+ (*errors)++;
}
if (key)
free (key);