Skip to content
Snippets Groups Projects
Commit 467e9548 authored by Martine Lenders's avatar Martine Lenders
Browse files

gnrc_netreg: optimize gnrc_netreg_num() to use _netreg_lookup()

parent dbda759b
No related branches found
No related tags found
No related merge requests found
...@@ -99,22 +99,11 @@ gnrc_netreg_entry_t *gnrc_netreg_lookup(gnrc_nettype_t type, uint32_t demux_ctx) ...@@ -99,22 +99,11 @@ gnrc_netreg_entry_t *gnrc_netreg_lookup(gnrc_nettype_t type, uint32_t demux_ctx)
int gnrc_netreg_num(gnrc_nettype_t type, uint32_t demux_ctx) int gnrc_netreg_num(gnrc_nettype_t type, uint32_t demux_ctx)
{ {
int num = 0; int num = 0;
gnrc_netreg_entry_t *entry; gnrc_netreg_entry_t *entry = NULL;
if (_INVALID_TYPE(type)) { while((entry = _netreg_lookup(entry, type, demux_ctx)) != NULL) {
return 0; num++;
}
entry = netreg[type];
while (entry != NULL) {
if (entry->demux_ctx == demux_ctx) {
num++;
}
entry = entry->next;
} }
return num; return num;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment