1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

gnrc_netreg: make message queue check more readable

This commit is contained in:
Martine Lenders 2018-11-15 14:06:57 +01:00 committed by Martine Lenders
parent c8937f8d40
commit 986b9d380b

View File

@ -39,13 +39,14 @@ void gnrc_netreg_init(void)
int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
{
#ifdef DEVELHELP
#if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS)
#if DEVELHELP
# if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS)
bool has_msg_q = (entry->type != GNRC_NETREG_TYPE_DEFAULT) ||
sched_threads[entry->target.pid]->msg_array;
#else
bool has_msg_q = sched_threads[entry->target.pid]->msg_array;
#endif
(sched_threads[entry->target.pid]->msg_array != NULL);
# else
bool has_msg_q = (sched_threads[entry->target.pid]->msg_array != NULL);
# endif
/* only threads with a message queue are allowed to register at gnrc */
if (!has_msg_q) {
@ -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);
}
assert(has_msg_q);
#endif
#endif /* DEVELHELP */
if (_INVALID_TYPE(type)) {
return -EINVAL;