Skip to content
Snippets Groups Projects
Commit 986b9d38 authored by Martine Lenders's avatar Martine Lenders Committed by Martine Lenders
Browse files

gnrc_netreg: make message queue check more readable

parent c8937f8d
No related branches found
No related tags found
No related merge requests found
...@@ -39,13 +39,14 @@ void gnrc_netreg_init(void) ...@@ -39,13 +39,14 @@ void gnrc_netreg_init(void)
int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry) int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
{ {
#ifdef DEVELHELP #if DEVELHELP
#if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS)
# if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS)
bool has_msg_q = (entry->type != GNRC_NETREG_TYPE_DEFAULT) || bool has_msg_q = (entry->type != GNRC_NETREG_TYPE_DEFAULT) ||
sched_threads[entry->target.pid]->msg_array; (sched_threads[entry->target.pid]->msg_array != NULL);
#else # else
bool has_msg_q = sched_threads[entry->target.pid]->msg_array; bool has_msg_q = (sched_threads[entry->target.pid]->msg_array != NULL);
#endif # endif
/* only threads with a message queue are allowed to register at gnrc */ /* only threads with a message queue are allowed to register at gnrc */
if (!has_msg_q) { if (!has_msg_q) {
...@@ -53,7 +54,7 @@ int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry) ...@@ -53,7 +54,7 @@ int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
"using msg_init_queue() !!!!\n\n", entry->target.pid); "using msg_init_queue() !!!!\n\n", entry->target.pid);
} }
assert(has_msg_q); assert(has_msg_q);
#endif #endif /* DEVELHELP */
if (_INVALID_TYPE(type)) { if (_INVALID_TYPE(type)) {
return -EINVAL; return -EINVAL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment