diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-04-30 19:38:15 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-05-02 16:21:38 -0400 |
| commit | 98d28ef55dd11a6efaa2bf3101ac57cf78e803bb (patch) | |
| tree | 909a355bc744069a1286b45063b043b1b8bc8216 /lib/typesafe.h | |
| parent | aa57abfbb57c2dd31eeb26d6988af57cb2e15a6b (diff) | |
lib: Make _find functions treat the head as const
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>
Diffstat (limited to 'lib/typesafe.h')
| -rw-r--r-- | lib/typesafe.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/typesafe.h b/lib/typesafe.h index bbf3ce8f1c..94002da599 100644 --- a/lib/typesafe.h +++ b/lib/typesafe.h @@ -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); \ |
