htable: add htable_type _delval.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 20 Feb 2020 02:31:19 +0000 (13:01 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 20 Feb 2020 02:31:19 +0000 (13:01 +1030)
To match the raw delval

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/htable/htable_type.h

index 192824c2d9c80649026021b5cd745e6ed63d2326..bb5ea086b7319fd3cd1c19b0dceece1974cfe8d4 100644 (file)
@@ -35,6 +35,9 @@
  *     bool <name>_del(struct <name> *ht, const <type> *e);
  *     bool <name>_delkey(struct <name> *ht, const <keytype> *k);
  *
+ * Delete by iterator:
+ *     bool <name>_delval(struct <name> *ht, struct <name>_iter *i);
+ *
  * Find and return the (first) matching element, or NULL:
  *     type *<name>_get(const struct @name *ht, const <keytype> *k);
  *
                        return name##_del(ht, elem);                    \
                return false;                                           \
        }                                                               \
+       static inline UNNEEDED void name##_delval(struct name *ht,      \
+                                                 struct name##_iter *iter) \
+       {                                                               \
+               htable_delval(&ht->raw, &iter->i);                      \
+       }                                                               \
        static inline UNNEEDED type *name##_pick(const struct name *ht, \
                                                size_t seed,            \
                                                struct name##_iter *iter) \