summaryrefslogtreecommitdiff
path: root/src/core/wee-infolist.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-06-26 18:15:42 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-06-26 18:15:42 +0200
commit19bc95b96189de5a645adbe7b3487d5de1b835e7 (patch)
treeb68d3d98d3d643bc02fba218db7f7ed6cd07ea2c /src/core/wee-infolist.c
parent2a630031fd3c868733e3038c3e19ad4b53a8d8ce (diff)
downloadweechat-19bc95b96189de5a645adbe7b3487d5de1b835e7.zip
core: many improvements on hdata
New features: - add optional hdata name for variables in hdata - add plugin API functions: hdata_get_var_hdata - use hashtable to store hdata (created by WeeChat and plugins) - free hdata and infolists created by plugin on plugin unload - free all hdata on exit - add "free" option to command /debug hdata - remove hdata for hooks
Diffstat (limited to 'src/core/wee-infolist.c')
-rw-r--r--src/core/wee-infolist.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/core/wee-infolist.c b/src/core/wee-infolist.c
index 3bc763e94..31f484925 100644
--- a/src/core/wee-infolist.c
+++ b/src/core/wee-infolist.c
@@ -43,13 +43,14 @@ struct t_infolist *last_weechat_infolist = NULL;
*/
struct t_infolist *
-infolist_new ()
+infolist_new (struct t_weechat_plugin *plugin)
{
struct t_infolist *new_infolist;
new_infolist = malloc (sizeof (*new_infolist));
if (new_infolist)
{
+ new_infolist->plugin = plugin;
new_infolist->items = NULL;
new_infolist->last_item = NULL;
new_infolist->ptr_item = NULL;
@@ -645,6 +646,25 @@ infolist_free (struct t_infolist *infolist)
}
/*
+ * infolist_free_all_plugin: free all infolists created by a plugin
+ */
+
+void
+infolist_free_all_plugin (struct t_weechat_plugin *plugin)
+{
+ struct t_infolist *ptr_infolist, *next_infolist;
+
+ ptr_infolist = weechat_infolists;
+ while (ptr_infolist)
+ {
+ next_infolist = ptr_infolist->next_infolist;
+ if (ptr_infolist->plugin == plugin)
+ infolist_free (ptr_infolist);
+ ptr_infolist = next_infolist;
+ }
+}
+
+/*
* infolist_print_log: print infolists infos in log (usually for crash dump)
*/
@@ -660,6 +680,7 @@ infolist_print_log ()
{
log_printf ("");
log_printf ("[infolist (addr:0x%lx)]", ptr_infolist);
+ log_printf (" plugin . . . . . . . . : 0x%lx", ptr_infolist->plugin);
log_printf (" items. . . . . . . . . : 0x%lx", ptr_infolist->items);
log_printf (" last_item. . . . . . . : 0x%lx", ptr_infolist->last_item);
log_printf (" ptr_item . . . . . . . : 0x%lx", ptr_infolist->ptr_item);