mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-12 00:30:19 +00:00
Use glib for all allocations
- Removes need to check for malloc failure - Removes need for NULL checks on free - Adds checks for integer overflows - Removes some extra memset calls - Removes chance of mixing libc and glib malloc/free
This commit is contained in:
@@ -53,9 +53,9 @@ static void
|
||||
timer_del (timer *tim)
|
||||
{
|
||||
timer_list = g_slist_remove (timer_list, tim);
|
||||
free (tim->command);
|
||||
g_free (tim->command);
|
||||
hexchat_unhook (ph, tim->hook);
|
||||
free (tim);
|
||||
g_free (tim);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -119,11 +119,11 @@ timer_add (int ref, int timeout, int repeat, char *command)
|
||||
}
|
||||
}
|
||||
|
||||
tim = malloc (sizeof (timer));
|
||||
tim = g_new (timer, 1);
|
||||
tim->ref = ref;
|
||||
tim->repeat = repeat;
|
||||
tim->timeout = timeout;
|
||||
tim->command = strdup (command);
|
||||
tim->command = g_strdup (command);
|
||||
tim->context = hexchat_get_context (ph);
|
||||
tim->forever = FALSE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user