simplified add_channel;
This commit is contained in:
parent
f7348448b4
commit
df4f869d2e
12
ii.c
12
ii.c
@ -119,17 +119,15 @@ static void add_channel(char *name)
|
|||||||
perror("ii: cannot create in channel");
|
perror("ii: cannot create in channel");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!channels)
|
c = calloc(1, sizeof(Channel));
|
||||||
channels = c = calloc(1, sizeof(Channel));
|
|
||||||
else {
|
|
||||||
for(c = channels; c && c->next; c = c->next);
|
|
||||||
c->next = calloc(1, sizeof(Channel));
|
|
||||||
c = c->next;
|
|
||||||
}
|
|
||||||
if(!c) {
|
if(!c) {
|
||||||
perror("ii: cannot allocate memory");
|
perror("ii: cannot allocate memory");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
if(channels)
|
||||||
|
channels = c;
|
||||||
|
else
|
||||||
|
c->next = channels;
|
||||||
c->fd = fd;
|
c->fd = fd;
|
||||||
c->name = strdup(name);
|
c->name = strdup(name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user