projects
/
umurmur.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix my name in the list of contributors.
[umurmur.git]
/
src
/
channel.c
diff --git
a/src/channel.c
b/src/channel.c
index fdf4e82df9acab3a9597b56b5449d13508068b23..346ea44ddfd9699f19da2181b77de2b85aefeab1 100644
(file)
--- a/
src/channel.c
+++ b/
src/channel.c
@@
-32,6
+32,7
@@
#include <stdlib.h>
#include <string.h>
#include "log.h"
#include <stdlib.h>
#include <string.h>
#include "log.h"
+#include "memory.h"
#include "list.h"
#include "client.h"
#include "channel.h"
#include "list.h"
#include "client.h"
#include "channel.h"
@@
-46,10
+47,7
@@
static channel_t *createChannel(int id, const char *name, const char *desc)
{
channel_t *ch;
{
channel_t *ch;
- ch = malloc(sizeof(channel_t));
- if (ch == NULL)
- Log_fatal("out of memory");
- memset(ch, 0, sizeof(channel_t));
+ ch = Memory_safeCalloc(1, sizeof(channel_t));
ch->id = id;
ch->name = strdup(name);
if (desc)
ch->id = id;
ch->name = strdup(name);
if (desc)
@@
-222,9
+220,7
@@
void Chan_init()
else
ch_dst = ch_itr;
else
ch_dst = ch_itr;
- chl = malloc(sizeof(channellist_t));
- if(!chl)
- Log_fatal("Out of memory");
+ chl = Memory_safeMalloc(1, sizeof(channellist_t));
chl->chan = ch_dst;
init_list_entry(&chl->node);
list_add_tail(&chl->node, &ch_src->channel_links);
chl->chan = ch_dst;
init_list_entry(&chl->node);
list_add_tail(&chl->node, &ch_src->channel_links);
@@
-382,9
+378,7
@@
void Chan_buildTreeList(channel_t *ch, struct dlist *head)
struct dlist *itr;
channel_t *sub;
struct dlist *itr;
channel_t *sub;
- chl = malloc(sizeof(channellist_t));
- if(!chl)
- Log_fatal("Out of memory");
+ chl = Memory_safeMalloc(1, sizeof(channellist_t));
chl->chan = ch;
init_list_entry(&chl->node);
list_add_tail(&chl->node, head);
chl->chan = ch;
init_list_entry(&chl->node);
list_add_tail(&chl->node, head);