diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2014-01-05 14:37:27 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2014-01-05 14:37:27 +0100 |
commit | 846dde00aae772c5df89da7534409cab73952650 (patch) | |
tree | a73a87d659a61edfa6358e5c23649d28ac9d0756 /src/core/wee-hdata.c | |
parent | 7dfaca9ef3caa939e19c310eb5d2ecc67a891689 (diff) | |
download | weechat-846dde00aae772c5df89da7534409cab73952650.zip |
core: fix crash with hdata_update on shared strings, add hdata type "shared_string" (bug #41104)
Diffstat (limited to 'src/core/wee-hdata.c')
-rw-r--r-- | src/core/wee-hdata.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c index e6d710c4c..fea9207b4 100644 --- a/src/core/wee-hdata.c +++ b/src/core/wee-hdata.c @@ -254,6 +254,7 @@ hdata_get_var_array_size (struct t_hdata *hdata, void *pointer, * types: string, pointer, hashtable) */ if ((var->type == WEECHAT_HDATA_STRING) + || (var->type == WEECHAT_HDATA_SHARED_STRING) || (var->type == WEECHAT_HDATA_POINTER) || (var->type == WEECHAT_HDATA_HASHTABLE)) { @@ -266,6 +267,7 @@ hdata_get_var_array_size (struct t_hdata *hdata, void *pointer, switch (var->type) { case WEECHAT_HDATA_STRING: + case WEECHAT_HDATA_SHARED_STRING: ptr_value = (*((char ***)(pointer + var->offset)))[i]; break; case WEECHAT_HDATA_POINTER: @@ -836,6 +838,13 @@ hdata_set (struct t_hdata *hdata, void *pointer, const char *name, *ptr_string = (value) ? strdup (value) : NULL; return 1; break; + case WEECHAT_HDATA_SHARED_STRING: + ptr_string = (char **)(pointer + var->offset); + if (*ptr_string) + string_shared_free (*ptr_string); + *ptr_string = (value) ? (char *)string_shared_get (value) : NULL; + return 1; + break; case WEECHAT_HDATA_POINTER: rc = sscanf (value, "%lx", &ptr); if ((rc != EOF) && (rc != 0)) |