From 581aa6b70b82b743f429a7a5283ef18e3a850622 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 13 Jan 2021 09:59:26 +0100 Subject: [PATCH] sys/net/netif: allow const in netif_iter() For consistency with `gnrc_netif_iter()`, add the `const` qualifier to the parameter of `netif_iter()`. This allows calling it on `const` pointers without having to cast `netif_t *`, which (apart of dropping the `const` qualifier) disables a lot of type safety checks offered by the compiler. --- sys/include/net/netif.h | 2 +- sys/net/netif/netif.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/include/net/netif.h b/sys/include/net/netif.h index e85272a4ee..2316695fa3 100644 --- a/sys/include/net/netif.h +++ b/sys/include/net/netif.h @@ -84,7 +84,7 @@ typedef struct { * @return next network interface. * @return NULL, if there is no interface after @p last */ -netif_t *netif_iter(netif_t *last); +netif_t *netif_iter(const netif_t *last); /** * @brief Gets name of an interface diff --git a/sys/net/netif/netif.c b/sys/net/netif/netif.c index b5c4e33f88..57064d05d7 100644 --- a/sys/net/netif/netif.c +++ b/sys/net/netif/netif.c @@ -36,7 +36,7 @@ int netif_register(netif_t *netif) return 0; } -netif_t *netif_iter(netif_t *last) +netif_t *netif_iter(const netif_t *last) { if (last == NULL) { return (netif_t *)netif_list.next;