changed all calls to assert() to uhub_assert()

This commit is contained in:
Tilka 2012-05-02 21:06:46 +02:00
parent ccded3f642
commit d49127b507
11 changed files with 13 additions and 13 deletions

View File

@ -127,7 +127,7 @@ static int adc_msg_cache_append(struct adc_message* msg, const char* string, siz
memcpy(&msg->cache[msg->length], string, len); memcpy(&msg->cache[msg->length], string, len);
adc_msg_set_length(msg, msg->length + len); adc_msg_set_length(msg, msg->length + len);
assert(msg->capacity > msg->length); uhub_assert(msg->capacity > msg->length);
msg->cache[msg->length] = 0; msg->cache[msg->length] = 0;
return 1; return 1;
} }

View File

@ -60,7 +60,7 @@ struct command_base* command_initialize(struct hub_info* hub)
void command_shutdown(struct command_base* cbase) void command_shutdown(struct command_base* cbase)
{ {
commands_builtin_remove(cbase); commands_builtin_remove(cbase);
assert(list_size(cbase->handlers) == 0); uhub_assert(list_size(cbase->handlers) == 0);
list_destroy(cbase->handlers); list_destroy(cbase->handlers);
hub_free(cbase); hub_free(cbase);
} }

View File

@ -88,7 +88,7 @@ int event_queue_process(struct event_queue* queue)
} }
list_clear(queue->q1, event_queue_cleanup_callback); list_clear(queue->q1, event_queue_cleanup_callback);
assert(list_size(queue->q1) == 0); uhub_assert(list_size(queue->q1) == 0);
/* unlock queue */ /* unlock queue */
queue->locked = 0; queue->locked = 0;

View File

@ -524,7 +524,7 @@ static void hub_event_dispatcher(void* callback_data, struct event_data* message
int status; int status;
struct hub_info* hub = (struct hub_info*) callback_data; struct hub_info* hub = (struct hub_info*) callback_data;
struct hub_user* user = (struct hub_user*) message->ptr; struct hub_user* user = (struct hub_user*) message->ptr;
assert(hub != NULL); uhub_assert(hub != NULL);
switch (message->id) switch (message->id)
{ {

View File

@ -52,7 +52,7 @@ void hub_recvq_destroy(struct hub_recvq* q)
size_t hub_recvq_get(struct hub_recvq* q, void* buf, size_t bufsize) size_t hub_recvq_get(struct hub_recvq* q, void* buf, size_t bufsize)
{ {
assert(bufsize >= q->size); uhub_assert(bufsize >= q->size);
if (q->size) if (q->size)
{ {
size_t n = q->size; size_t n = q->size;
@ -126,7 +126,7 @@ void hub_sendq_add(struct hub_sendq* q, struct adc_message* msg_)
#ifdef DEBUG_SENDQ #ifdef DEBUG_SENDQ
debug_msg("hub_sendq_add", msg); debug_msg("hub_sendq_add", msg);
#endif #endif
assert(msg->cache && *msg->cache); uhub_assert(msg->cache && *msg->cache);
list_append(q->queue, msg); list_append(q->queue, msg);
q->size += msg->length; q->size += msg->length;
} }
@ -147,7 +147,7 @@ int hub_sendq_send(struct hub_sendq* q, struct hub_user* user)
int ret; int ret;
struct adc_message* msg = list_get_first(q->queue); struct adc_message* msg = list_get_first(q->queue);
if (!msg) return 0; if (!msg) return 0;
assert(msg->cache && *msg->cache); uhub_assert(msg->cache && *msg->cache);
ret = net_con_send(user->connection, msg->cache + q->offset, msg->length - q->offset); ret = net_con_send(user->connection, msg->cache + q->offset, msg->length - q->offset);
if (ret > 0) if (ret > 0)

View File

@ -26,7 +26,7 @@ struct plugin_callback_data;
struct plugin_hub_internals* get_internals(struct plugin_handle* handle) struct plugin_hub_internals* get_internals(struct plugin_handle* handle)
{ {
struct plugin_hub_internals* internals; struct plugin_hub_internals* internals;
assert(handle && handle->handle && handle->handle->internals); uhub_assert(handle && handle->handle && handle->handle->internals);
internals = (struct plugin_hub_internals*) handle->handle->internals; internals = (struct plugin_hub_internals*) handle->handle->internals;
return internals; return internals;
} }

View File

@ -106,7 +106,7 @@ int route_to_user(struct hub_info* hub, struct hub_user* user, struct adc_messag
if (!user->connection) if (!user->connection)
return 0; return 0;
assert(msg->cache && *msg->cache); uhub_assert(msg->cache && *msg->cache);
if (hub_sendq_is_empty(user->send_queue) && !user_flag_get(user, flag_pipeline)) if (hub_sendq_is_empty(user->send_queue) && !user_flag_get(user, flag_pipeline))
{ {

View File

@ -162,7 +162,7 @@ int uman_remove(struct hub_info* hub, struct hub_user* user)
} }
else else
{ {
assert(!"negative count!"); uhub_assert(!"negative count!");
} }
hub->users->shared_size -= user->limits.shared_size; hub->users->shared_size -= user->limits.shared_size;

View File

@ -160,7 +160,7 @@ static struct chat_history_data* parse_config(const char* line, struct plugin_ha
struct cfg_tokens* tokens = cfg_tokenize(line); struct cfg_tokens* tokens = cfg_tokenize(line);
char* token = cfg_token_get_first(tokens); char* token = cfg_token_get_first(tokens);
assert(data != NULL); uhub_assert(data != NULL);
data->history_max = 200; data->history_max = 200;
data->history_default = 25; data->history_default = 25;

View File

@ -112,4 +112,4 @@ const char* cbuf_get(struct cbuffer* buf)
size_t cbuf_size(struct cbuffer* buf) size_t cbuf_size(struct cbuffer* buf)
{ {
return buf->size; return buf->size;
} }

View File

@ -84,7 +84,7 @@ void list_append(struct linked_list* list, void* data_ptr)
void list_remove(struct linked_list* list, void* data_ptr) void list_remove(struct linked_list* list, void* data_ptr)
{ {
struct node* node = list->first; struct node* node = list->first;
assert(data_ptr); uhub_assert(data_ptr);
list->iterator = NULL; list->iterator = NULL;