summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/completion.c34
-rw-r--r--src/common/completion.h1
-rw-r--r--src/common/weelist.c20
-rw-r--r--src/common/weelist.h7
4 files changed, 59 insertions, 3 deletions
diff --git a/src/common/completion.c b/src/common/completion.c
index 35e8abd72..a6ddb732a 100644
--- a/src/common/completion.c
+++ b/src/common/completion.c
@@ -30,6 +30,7 @@
#include "weechat.h"
#include "completion.h"
#include "command.h"
+#include "log.h"
#include "utf8.h"
#include "weelist.h"
#include "weeconfig.h"
@@ -1350,3 +1351,36 @@ completion_search (t_completion *completion, int direction,
}
}
}
+
+/*
+ * completion_print_log: print completion list in log (usually for crash dump)
+ */
+
+void
+completion_print_log (t_completion *completion)
+{
+ weechat_log_printf ("[completion (addr:0x%X)]\n", completion);
+ weechat_log_printf (" server . . . . . . . . : 0x%X\n", completion->server);
+ weechat_log_printf (" channel. . . . . . . . : 0x%X\n", completion->channel);
+ weechat_log_printf (" context. . . . . . . . : %d\n", completion->context);
+ weechat_log_printf (" base_command . . . . . : '%s'\n", completion->base_command);
+ weechat_log_printf (" base_command_arg . . . : %d\n", completion->base_command_arg);
+ weechat_log_printf (" arg_is_nick. . . . . . : %d\n", completion->arg_is_nick);
+ weechat_log_printf (" base_word. . . . . . . : '%s'\n", completion->base_word);
+ weechat_log_printf (" base_word_pos. . . . . : %d\n", completion->base_word_pos);
+ weechat_log_printf (" position . . . . . . . : %d\n", completion->position);
+ weechat_log_printf (" args . . . . . . . . . : '%s'\n", completion->args);
+ weechat_log_printf (" direction. . . . . . . : %d\n", completion->direction);
+ weechat_log_printf (" completion_list. . . . : 0x%X\n", completion->completion_list);
+ weechat_log_printf (" last_completion. . . . : 0x%X\n", completion->last_completion);
+ weechat_log_printf (" word_found . . . . . . : '%s'\n", completion->word_found);
+ weechat_log_printf (" position_replace . . . : %d\n", completion->position_replace);
+ weechat_log_printf (" diff_size. . . . . . . : %d\n", completion->diff_size);
+ weechat_log_printf (" diff_length. . . . . . : %d\n", completion->diff_length);
+ if (completion->completion_list)
+ {
+ weechat_log_printf ("\n");
+ weelist_print_log (completion->completion_list,
+ "completion list element");
+ }
+}
diff --git a/src/common/completion.h b/src/common/completion.h
index ea2e89add..c65d7ce0d 100644
--- a/src/common/completion.h
+++ b/src/common/completion.h
@@ -59,5 +59,6 @@ struct t_completion
extern void completion_init (t_completion *, void *, void *);
extern void completion_free (t_completion *);
extern void completion_search (t_completion *, int, char *, int, int);
+extern void completion_print_log (t_completion *);
#endif /* completion.h */
diff --git a/src/common/weelist.c b/src/common/weelist.c
index 137e2cccd..9b2d0cb2c 100644
--- a/src/common/weelist.c
+++ b/src/common/weelist.c
@@ -29,6 +29,7 @@
#include "weechat.h"
#include "weelist.h"
+#include "log.h"
/*
@@ -163,3 +164,22 @@ weelist_remove (t_weelist **weelist, t_weelist **last_weelist, t_weelist *elemen
free (element);
*weelist = new_weelist;
}
+
+/*
+ * weelist_print_log: print weelist in log (usually for crash dump)
+ */
+
+void
+weelist_print_log (t_weelist *weelist, char *name)
+{
+ t_weelist *ptr_weelist;
+
+ for (ptr_weelist = weelist; ptr_weelist;
+ ptr_weelist = ptr_weelist->next_weelist)
+ {
+ weechat_log_printf ("[%s (addr:0x%X)]\n", name, ptr_weelist);
+ weechat_log_printf (" data . . . . . . . . . : '%s'\n", ptr_weelist->data);
+ weechat_log_printf (" prev_weelist . . . . . : 0x%X\n", ptr_weelist->prev_weelist);
+ weechat_log_printf (" next_weelist . . . . . : 0x%X\n", ptr_weelist->next_weelist);
+ }
+}
diff --git a/src/common/weelist.h b/src/common/weelist.h
index 1818bd022..3350a3fc8 100644
--- a/src/common/weelist.h
+++ b/src/common/weelist.h
@@ -30,8 +30,9 @@ struct t_weelist
t_weelist *next_weelist;
};
-t_weelist *weelist_search (t_weelist *, char *);
-t_weelist *weelist_add (t_weelist **, t_weelist **, char *);
-void weelist_remove (t_weelist **, t_weelist **, t_weelist *);
+extern t_weelist *weelist_search (t_weelist *, char *);
+extern t_weelist *weelist_add (t_weelist **, t_weelist **, char *);
+extern void weelist_remove (t_weelist **, t_weelist **, t_weelist *);
+extern void weelist_print_log (t_weelist *, char *);
#endif /* weelist.h */