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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to