Author: vlendec
Date: 2005-04-03 16:08:18 +0000 (Sun, 03 Apr 2005)
New Revision: 6186

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6186

Log:
ADD_TO_ARRAY is a little macro that might eventually replace all the
add_x_to_array functions.

Volker

Modified:
   trunk/source/include/smb_macros.h


Changeset:
Modified: trunk/source/include/smb_macros.h
===================================================================
--- trunk/source/include/smb_macros.h   2005-04-03 04:36:00 UTC (rev 6185)
+++ trunk/source/include/smb_macros.h   2005-04-03 16:08:18 UTC (rev 6186)
@@ -347,4 +347,14 @@
 
 #endif
 
+#define ADD_TO_ARRAY(mem_ctx, type, elem, array, num) \
+do { \
+       *(array) = ((mem_ctx) != NULL) ? \
+               TALLOC_REALLOC_ARRAY(mem_ctx, (*(array)), type, (*(num))+1) : \
+               SMB_REALLOC_ARRAY((*(array)), type, (*(num))+1); \
+       SMB_ASSERT((*(array)) != NULL); \
+       (*(array))[*(num)] = (elem); \
+       (*(num)) += 1; \
+} while (0)
+
 #endif /* _SMB_MACROS_H */

Reply via email to