File: ht_utils.h

package info (click to toggle)
fungw 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,268 kB
  • sloc: ansic: 24,257; makefile: 500; sh: 32; awk: 9; perl: 8; tcl: 7; javascript: 7; ruby: 7; python: 6
file content (19 lines) | stat: -rw-r--r-- 500 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef GENHT_HT_UTILS_H
#define GENHT_HT_UTILS_H

/* iterate htent over all entries of ht, executing uninit_code on each and
   the uninit the hash table. Example call:

   genht_uninit_deep(htsp, &my_tasble, {
     free(htent->key);
     free(htent->value);
   });
*/
#define genht_uninit_deep(type, ht, uninit_code) \
do { \
	type ## _entry_t *htent; \
	for(htent = type ## _first(ht); htent != NULL; htent = type ## _next(ht, htent)) { uninit_code; } \
	type ## _uninit(ht); \
} while(0)

#endif