rxcallback_t newhandler,
u_short flags)
{
- struct aim_rxcblist_t *new,*cur;
+ struct aim_rxcblist_t *newcb;
if (!conn)
return -1;
faimdprintf(1, "aim_conn_addhandler: adding for %04x/%04x\n", family, type);
- new = (struct aim_rxcblist_t *)calloc(1, sizeof(struct aim_rxcblist_t));
- new->family = family;
- new->type = type;
- new->flags = flags;
+ if (!(newcb = (struct aim_rxcblist_t *)calloc(1, sizeof(struct aim_rxcblist_t))))
+ return -1;
+ newcb->family = family;
+ newcb->type = type;
+ newcb->flags = flags;
if (!newhandler)
- new->handler = &bleck;
+ newcb->handler = &bleck;
else
- new->handler = newhandler;
- new->next = NULL;
+ newcb->handler = newhandler;
+ newcb->next = NULL;
- cur = conn->handlerlist;
- if (!cur)
- conn->handlerlist = new;
- else
- {
- while (cur->next)
- cur = cur->next;
- cur->next = new;
- }
+ if (!conn->handlerlist)
+ conn->handlerlist = newcb;
+ else {
+ struct aim_rxcblist_t *cur;
+
+ cur = conn->handlerlist;
+
+ while (cur->next)
+ cur = cur->next;
+ cur->next = newcb;
+ }
return 0;
}
faim_export int aim_clearhandlers(struct aim_conn_t *conn)
{
- struct aim_rxcblist_t *cur,*tmp;
+ struct aim_rxcblist_t *cur;
+
if (!conn)
return -1;
cur = conn->handlerlist;
- while(cur)
- {
- tmp = cur->next;
- free(cur);
- cur = tmp;
- }
+ while(cur) {
+ struct aim_rxcblist_t *tmp;
+
+ tmp = cur->next;
+ free(cur);
+ cur = tmp;
+ }
+
return 0;
}
if (type==0xffff)
return NULL;
+
return aim_callhandler(conn, family, 0xffff);
}