diff options
author | des <des@FreeBSD.org> | 2009-06-13 13:54:03 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2009-06-13 13:54:03 +0000 |
commit | 306af13a0320e277c98758dd0874184365cb4152 (patch) | |
tree | 288b3dfc7b30fd5457e3f98e9025b849af1e8c9d /usr.sbin/nscd | |
parent | 9ec42af6d6c03969311a7aa16f633bd92672ced3 (diff) | |
download | FreeBSD-src-306af13a0320e277c98758dd0874184365cb4152.zip FreeBSD-src-306af13a0320e277c98758dd0874184365cb4152.tar.gz |
Wrap some macros that needed wrapping.
MFC after: 1 week
Diffstat (limited to 'usr.sbin/nscd')
-rw-r--r-- | usr.sbin/nscd/hashtable.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/usr.sbin/nscd/hashtable.h b/usr.sbin/nscd/hashtable.h index 4ad9e3e..26e6eb9 100644 --- a/usr.sbin/nscd/hashtable.h +++ b/usr.sbin/nscd/hashtable.h @@ -65,7 +65,8 @@ typedef unsigned int hashtable_index_t; size_t entries_size; \ } -#define HASHTABLE_ENTRIES_COUNT(table) ((table)->entries_size) +#define HASHTABLE_ENTRIES_COUNT(table) \ + ((table)->entries_size) /* * Unlike most of queue.h data types, hash tables can not be initialized @@ -99,7 +100,8 @@ typedef unsigned int hashtable_index_t; } \ } while (0) -#define HASHTABLE_GET_ENTRY(table, hash) (&((table)->entries[hash])) +#define HASHTABLE_GET_ENTRY(table, hash) \ + (&((table)->entries[hash])) /* * Traverses through all hash table entries @@ -127,14 +129,18 @@ typedef unsigned int hashtable_index_t; ((entry)->field.capacity) #define HASHTABLE_ENTRY_CAPACITY_INCREASE(entry, field, type) \ - (entry)->field.capacity *= 2; \ - (entry)->field.values = realloc((entry)->field.values, \ - (entry)->field.capacity * sizeof(type)); + do { \ + (entry)->field.capacity *= 2; \ + (entry)->field.values = realloc((entry)->field.values, \ + (entry)->field.capacity * sizeof(type)); \ + } while (0) #define HASHTABLE_ENTRY_CAPACITY_DECREASE(entry, field, type) \ - (entry)->field.capacity /= 2; \ - (entry)->field.values = realloc((entry)->field.values, \ - (entry)->field.capacity * sizeof(type)); + do { \ + (entry)->field.capacity /= 2; \ + (entry)->field.values = realloc((entry)->field.values, \ + (entry)->field.capacity * sizeof(type)); \ + } while (0) /* * Generates prototypes for the hash table functions |