From a8784eff9f40ca284cb03ae30a93287ea635ba91 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 25 Jul 2024 15:10:40 +0200 Subject: [RCFILE] Added support for generic names in RCFiles --- src/include/khash.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/include/khash.h') diff --git a/src/include/khash.h b/src/include/khash.h index 9d20a0e6..823757bf 100644 --- a/src/include/khash.h +++ b/src/include/khash.h @@ -552,6 +552,21 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key) code; \ } } +/*! @function + @abstract Iterate over the entries in the hash table + @param h Pointer to the hash table [khash_t(name)*] + @param kvar Variable to which key will be assigned + @param vvar Variable to which value will be assigned + @param code Block of code to execute + */ +#define kh_foreach_ref(h, kvar, rvar, code) { khint_t __i; \ + for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \ + if (!kh_exist(h,__i)) continue; \ + (kvar) = kh_key(h,__i); \ + (rvar) = &kh_val(h,__i); \ + code; \ + } } + /*! @function @abstract Iterate over the entries in the hash table @param h Pointer to the hash table [khash_t(name)*] -- cgit 1.4.1