channel: Make channel_{un}subscribe abort the program for invalid ids

These functions will never be called directly by the user so bugs are the only
reason for passing invalid channel ids. Instead of returning silently we abort
to improve bug detection.
This commit is contained in:
Thiago de Arruda
2014-06-17 12:21:53 -03:00
parent abc423983d
commit 4cb5ce3c52

View File

@@ -141,7 +141,7 @@ void channel_subscribe(uint64_t id, char *event)
Channel *channel; Channel *channel;
if (!(channel = pmap_get(uint64_t)(channels, id))) { if (!(channel = pmap_get(uint64_t)(channels, id))) {
return; abort();
} }
char *event_string = pmap_get(cstr_t)(event_strings, event); char *event_string = pmap_get(cstr_t)(event_strings, event);
@@ -163,7 +163,7 @@ void channel_unsubscribe(uint64_t id, char *event)
Channel *channel; Channel *channel;
if (!(channel = pmap_get(uint64_t)(channels, id))) { if (!(channel = pmap_get(uint64_t)(channels, id))) {
return; abort();
} }
unsubscribe(channel, event); unsubscribe(channel, event);