Date: Sat, 13 Jun 2009 13:54:04 +0000 (UTC) From: Dag-Erling Smorgrav <des@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r194109 - head/usr.sbin/nscd Message-ID: <200906131354.n5DDs4Za015582@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: des Date: Sat Jun 13 13:54:03 2009 New Revision: 194109 URL: http://svn.freebsd.org/changeset/base/194109 Log: Wrap some macros that needed wrapping. MFC after: 1 week Modified: head/usr.sbin/nscd/hashtable.h Modified: head/usr.sbin/nscd/hashtable.h ============================================================================== --- head/usr.sbin/nscd/hashtable.h Sat Jun 13 13:49:12 2009 (r194108) +++ head/usr.sbin/nscd/hashtable.h Sat Jun 13 13:54:03 2009 (r194109) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906131354.n5DDs4Za015582>