summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-10-08 22:51:08 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-10-08 22:51:08 +0200
commit82697714e1b51968dc852c9194deb2e0bf159596 (patch)
treeefac3e1129a556e98ca4a864d6f44b79ed9d02fd /src
parenta774ffd4e89055efcd2412bed21ab56df914383f (diff)
downloadweechat-82697714e1b51968dc852c9194deb2e0bf159596.zip
core: fix evaluation of nested ternary operators (closes #1263)
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-eval.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c
index b9a092a65..9ba2dd9d2 100644
--- a/src/core/wee-eval.c
+++ b/src/core/wee-eval.c
@@ -317,7 +317,8 @@ eval_replace_vars_cb (void *data, const char *text)
struct t_config_option *ptr_option;
struct t_gui_buffer *ptr_buffer;
char str_value[512], *value, *pos, *pos1, *pos2, *hdata_name, *list_name;
- char *tmp, *info_name, *hide_char, *hidden_string, *error, *condition;
+ char *tmp, *tmp2, *info_name, *hide_char, *hidden_string, *error;
+ char *condition;
const char *ptr_value, *ptr_arguments, *ptr_string;
struct t_hdata *hdata;
void *pointer;
@@ -556,10 +557,13 @@ eval_replace_vars_cb (void *data, const char *text)
strndup (text + 3, pos - (text + 3)) : strdup (text + 3);
if (!condition)
return strdup ("");
- tmp = eval_expression_condition (condition, eval_context);
- rc = eval_is_true (tmp);
+ tmp = eval_replace_vars (condition, eval_context);
+ tmp2 = eval_expression_condition ((tmp) ? tmp : "", eval_context);
+ rc = eval_is_true (tmp2);
if (tmp)
free (tmp);
+ if (tmp2)
+ free (tmp2);
if (rc)
{
/*