summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-05-20 00:05:31 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-05-20 00:05:31 +0200
commit925e8b79a820711989a026989d26ee8c86616d73 (patch)
tree25078075d99bb04e719b9044189d429a4b7c2903 /src
parent455a0e501c760c8c9553d977c7913ca6a9f06742 (diff)
downloadweechat-925e8b79a820711989a026989d26ee8c86616d73.zip
core: allow index for hdata arrays in evaluation of expressions
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-eval.c7
-rw-r--r--src/core/wee-hdata.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c
index 6864a94d6..7180c77a5 100644
--- a/src/core/wee-eval.c
+++ b/src/core/wee-eval.c
@@ -147,8 +147,8 @@ char *
eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path)
{
char *value, *old_value, *var_name, str_value[128], *pos;
- const char *ptr_value, *hdata_name;
- int type;
+ const char *ptr_value, *hdata_name, *ptr_var_name;
+ int type, index;
struct t_hashtable *hashtable;
value = NULL;
@@ -180,7 +180,8 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path)
goto end;
/* search type of variable in hdata */
- type = hdata_get_var_type (hdata, var_name);
+ hdata_get_index_and_name (var_name, &index, &ptr_var_name);
+ type = hdata_get_var_type (hdata, ptr_var_name);
if (type < 0)
goto end;
diff --git a/src/core/wee-hdata.h b/src/core/wee-hdata.h
index c7c615d3e..c6cde0503 100644
--- a/src/core/wee-hdata.h
+++ b/src/core/wee-hdata.h
@@ -110,6 +110,8 @@ extern int hdata_check_pointer (struct t_hdata *hdata, void *list,
extern void *hdata_move (struct t_hdata *hdata, void *pointer, int count);
extern void *hdata_search (struct t_hdata *hdata, void *pointer,
const char *search, int move);
+extern void hdata_get_index_and_name (const char *name, int *index,
+ const char **ptr_name);
extern char hdata_char (struct t_hdata *hdata, void *pointer,
const char *name);
extern int hdata_integer (struct t_hdata *hdata, void *pointer,