]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Make _find functions treat the head as const
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 30 Apr 2019 23:38:15 +0000 (19:38 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 2 May 2019 20:21:38 +0000 (16:21 -0400)
The head of a list should not change for find functions.  Probably
are others that should be considered but these changes can come
in as needed I believe.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/typesafe.h

index bbf3ce8f1cb508c8aaa447064f02d67d954509ba..94002da599c23ea4d66a3184bbc63486f2825cc3 100644 (file)
@@ -275,7 +275,7 @@ macro_pure size_t prefix ## _count(struct prefix##_head *h)                    \
 #define DECLARE_SORTLIST_UNIQ(prefix, type, field, cmpfn)                      \
        _DECLARE_SORTLIST(prefix, type, field, cmpfn, cmpfn)                   \
                                                                                \
-macro_inline type *prefix ## _find(struct prefix##_head *h, const type *item)  \
+macro_inline type *prefix ## _find(const struct prefix##_head *h, const type *item)  \
 {                                                                              \
        struct ssort_item *sitem = h->sh.first;                                \
        int cmpval = 0;                                                        \
@@ -383,7 +383,7 @@ macro_inline type *prefix ## _add(struct prefix##_head *h, type *item)         \
        *np = &item->field.hi;                                                 \
        return NULL;                                                           \
 }                                                                              \
-macro_inline type *prefix ## _find(struct prefix##_head *h, const type *item)  \
+macro_inline type *prefix ## _find(const struct prefix##_head *h, const type *item)  \
 {                                                                              \
        if (!h->hh.tabshift)                                                   \
                return NULL;                                                   \
@@ -576,7 +576,7 @@ macro_inline int prefix ## __cmp(const struct sskip_item *a,                   \
        return cmpfn(container_of(a, type, field.si),                          \
                        container_of(b, type, field.si));                      \
 }                                                                              \
-macro_inline type *prefix ## _find(struct prefix##_head *h, const type *item)  \
+macro_inline type *prefix ## _find(const struct prefix##_head *h, const type *item)  \
 {                                                                              \
        struct sskip_item *sitem = typesafe_skiplist_find(&h->sh,              \
                        &item->field.si, &prefix ## __cmp);                    \