summaryrefslogtreecommitdiff
path: root/source3/include/smb_macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'source3/include/smb_macros.h')
-rw-r--r--source3/include/smb_macros.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 1076bd53e8..ab4ee5ee73 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -351,4 +351,14 @@ copy an IP address from one buffer to another
#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 */