mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 05:46:38 +02:00
core: fix recursive calls to function eval_expression
This commit is contained in:
@@ -15,6 +15,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
|
||||
== Version 0.4.4 (under dev)
|
||||
|
||||
* core: fix recursive calls to function eval_expression
|
||||
* core: mute all buffers by default in command /mute (replace option -all by
|
||||
-core)
|
||||
* core: save and restore mute state in command /mute (bug #41748)
|
||||
|
||||
+13
-28
@@ -780,7 +780,7 @@ char *
|
||||
eval_expression (const char *expr, struct t_hashtable *pointers,
|
||||
struct t_hashtable *extra_vars, struct t_hashtable *options)
|
||||
{
|
||||
int condition, rc;
|
||||
int condition, rc, pointers_allocated;
|
||||
char *value;
|
||||
const char *prefix, *suffix, *default_prefix = "${", *default_suffix = "}";
|
||||
const char *ptr_value;
|
||||
@@ -790,25 +790,21 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
|
||||
return NULL;
|
||||
|
||||
condition = 0;
|
||||
pointers_allocated = 0;
|
||||
prefix = default_prefix;
|
||||
suffix = default_suffix;
|
||||
|
||||
/* create hashtable pointers if it's NULL */
|
||||
if (!pointers)
|
||||
{
|
||||
if (eval_hashtable_pointers)
|
||||
hashtable_remove_all (eval_hashtable_pointers);
|
||||
else
|
||||
{
|
||||
eval_hashtable_pointers = hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_POINTER,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!eval_hashtable_pointers)
|
||||
return NULL;
|
||||
}
|
||||
pointers = eval_hashtable_pointers;
|
||||
pointers = hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_POINTER,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!pointers)
|
||||
return NULL;
|
||||
pointers_allocated = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -863,19 +859,8 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
|
||||
value = eval_replace_vars (expr, pointers, extra_vars, prefix, suffix);
|
||||
}
|
||||
|
||||
if (pointers_allocated)
|
||||
hashtable_free (pointers);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Frees all allocated data.
|
||||
*/
|
||||
|
||||
void
|
||||
eval_end ()
|
||||
{
|
||||
if (eval_hashtable_pointers)
|
||||
{
|
||||
hashtable_free (eval_hashtable_pointers);
|
||||
eval_hashtable_pointers = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,5 @@ extern char *eval_expression (const char *expr,
|
||||
struct t_hashtable *pointers,
|
||||
struct t_hashtable *extra_vars,
|
||||
struct t_hashtable *options);
|
||||
extern void eval_end ();
|
||||
|
||||
#endif /* __WEECHAT_EVAL_H */
|
||||
|
||||
@@ -489,7 +489,6 @@ main (int argc, char *argv[])
|
||||
gui_key_end (); /* remove all keys */
|
||||
unhook_all (); /* remove all hooks */
|
||||
hdata_end (); /* end hdata */
|
||||
eval_end (); /* end eval */
|
||||
secure_end (); /* end secured data */
|
||||
string_end (); /* end string */
|
||||
weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
Reference in New Issue
Block a user