diff options
Diffstat (limited to 'custom_mutators/gramatron/uthash.h')
-rw-r--r-- | custom_mutators/gramatron/uthash.h | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/custom_mutators/gramatron/uthash.h b/custom_mutators/gramatron/uthash.h index 93322d5b..05c8abe6 100644 --- a/custom_mutators/gramatron/uthash.h +++ b/custom_mutators/gramatron/uthash.h @@ -127,8 +127,6 @@ typedef unsigned char uint8_t; #if HASH_NONFATAL_OOM /* malloc failures can be recovered from */ - #define IF_HASH_NONFATAL_OOM(x) x - #ifndef uthash_nonfatal_oom #define uthash_nonfatal_oom(obj) \ do { \ @@ -142,6 +140,8 @@ typedef unsigned char uint8_t; (oomed) = 1; \ \ } while (0) +\ + #define IF_HASH_NONFATAL_OOM(x) x #else /* malloc failures result in lost memory, hash tables are unusable */ @@ -156,10 +156,11 @@ typedef unsigned char uint8_t; #endif /* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets \ - */ -#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ +#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ +#define HASH_INITIAL_NUM_BUCKETS_LOG2 \ + 5U /* lg2 of initial number of buckets \ + */ +#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ /* calculate the element whose hash handle address is hhp */ #define ELMT_FROM_HH(tbl, hhp) ((void *)(((char *)(hhp)) - ((tbl)->hho))) @@ -646,7 +647,7 @@ typedef unsigned char uint8_t; HASH_FIND(hh, head, findstr, _uthash_hfstr_keylen, out); \ \ } while (0) - +\ #define HASH_ADD_STR(head, strfield, add) \ do { \ \ @@ -654,7 +655,7 @@ typedef unsigned char uint8_t; HASH_ADD(hh, head, strfield[0], _uthash_hastr_keylen, add); \ \ } while (0) - +\ #define HASH_REPLACE_STR(head, strfield, add, replaced) \ do { \ \ @@ -662,7 +663,7 @@ typedef unsigned char uint8_t; HASH_REPLACE(hh, head, strfield[0], _uthash_hrstr_keylen, add, replaced); \ \ } while (0) - +\ #define HASH_FIND_INT(head, findint, out) \ HASH_FIND(hh, head, findint, sizeof(int), out) #define HASH_ADD_INT(head, intfield, add) \ @@ -682,17 +683,17 @@ typedef unsigned char uint8_t; * isn't defined. */ #ifdef HASH_DEBUG - #define HASH_OOPS(...) \ + #define HASH_OOPS(...) \ + do { \ + \ + fprintf(stderr, __VA_ARGS__); \ + exit(-1); \ + \ + } while (0) +\ + #define HASH_FSCK(hh, head, where) \ do { \ \ - fprintf(stderr, __VA_ARGS__); \ - exit(-1); \ - \ - } while (0) \ - \ - \ - #define HASH_FSCK(hh, head, where) do { \ - \ struct UT_hash_handle *_thh; \ if (head) { \ \ @@ -758,8 +759,7 @@ typedef unsigned char uint8_t; \ } \ \ - } \ - while (0) + } while (0) #else #define HASH_FSCK(hh, head, where) @@ -1352,7 +1352,6 @@ typedef unsigned char uint8_t; \ } else if ((cmpfcn(DECLTYPE(head)( \ \ - \ ELMT_FROM_HH((head)->hh.tbl, _hs_p)), \ DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, \ _hs_q)))) <= 0) { \ |