Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 9 additions and 7 deletions.
  1. +3 −3 src/hook.c
  2. +3 −1 src/message.c
  3. +3 −3 src/unicorn.h
View
6 src/hook.c
@@ -73,7 +73,7 @@ int irc_hook_table_destroy(irc_hook_table_t *table)
}
-int irc_hook_add(irc_hook_table_t *table, char *hook, irc_hook_cb_t *cb, void *priv)
+int irc_hook_add(irc_hook_table_t *table, const char *hook, irc_hook_cb_t *cb, void *priv)
{
irc_hook_t *newhook, *head;
@@ -92,7 +92,7 @@ int irc_hook_add(irc_hook_table_t *table, char *hook, irc_hook_cb_t *cb, void *p
}
-int irc_hook_call(irc_hook_table_t *table, char *hook, int parc, char *parv[])
+int irc_hook_call(irc_hook_table_t *table, const char *hook, int parc, const char *parv[])
{
irc_hook_t *curr;
@@ -131,7 +131,7 @@ int irc_hook_simple_dispatch(irc_hook_table_t *table, irc_message_t *msg)
i++;
}
- i = irc_hook_call(table, msg->command, parc, parv);
+ i = irc_hook_call(table, msg->command, parc, (const char**)parv);
mowgli_free(parv);
View
4 src/message.c
@@ -36,10 +36,12 @@ int irc_message_reset(irc_message_t *msg)
return -1;
MOWGLI_LIST_FOREACH_SAFE(n, tn, msg->args.head) {
- mowgli_list_delete(n, &msg->args);
+ mowgli_node_delete(n, &msg->args);
mowgli_node_free(n);
}
+ memset(msg, 0, sizeof(*msg));
+
return 0;
}
View
6 src/unicorn.h
@@ -146,7 +146,7 @@ extern char irc_prefix_char(irc_prefix_t *pfx);
// NOTE: hooks are case-insensitive
-typedef void (irc_hook_cb_t)(int parc, char *parv[], void *priv);
+typedef void (irc_hook_cb_t)(int parc, const char *parv[], void *priv);
struct irc_hook {
irc_hook_cb_t *cb;
@@ -162,9 +162,9 @@ typedef struct irc_hook_table irc_hook_table_t;
extern irc_hook_table_t *irc_hook_table_create();
extern int irc_hook_table_destroy(irc_hook_table_t *table);
-extern int irc_hook_add(irc_hook_table_t *table, char *hook, irc_hook_cb_t *cb, void *priv);
+extern int irc_hook_add(irc_hook_table_t *table, const char *hook, irc_hook_cb_t *cb, void *priv);
-extern int irc_hook_call(irc_hook_table_t *table, char *hook, int parc, char *parv[]);
+extern int irc_hook_call(irc_hook_table_t *table, const char *hook, int parc, const char *parv[]);
// This function will take a message and call a particular hook based on
// a simple transformation. The hook to be called is simply the message

No commit comments for this range

Something went wrong with that request. Please try again.