summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/nameserv.h2
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/include/smb.h9
3 files changed, 11 insertions, 1 deletions
diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h
index 80d9667d1c..fe00a1415d 100644
--- a/source3/include/nameserv.h
+++ b/source3/include/nameserv.h
@@ -278,7 +278,7 @@ struct userdata_struct {
userdata_copy_fn copy_fn;
userdata_free_fn free_fn;
unsigned int userdata_len;
- char data[1];
+ char data[16]; /* 16 is to ensure alignment/padding on all systems */
};
struct response_record;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6594ac6143..991e4f3e31 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -356,6 +356,7 @@ char *tab_depth(int depth);
char *sid_to_string(pstring sidstr_out, DOM_SID *sid);
BOOL string_to_sid(DOM_SID *sidout, char *sidstr);
int str_checksum(char *s);
+void zero_free(void *p, int size);
/*The following definitions come from libsmb/clientgen.c */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index b615d09708..90435b208e 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1569,8 +1569,17 @@ extern int unix_ERR_code;
#define CMD_REPLY 0x8000
/* useful macros */
+
+/* zero a structure */
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
+
+/* zero a structure given a pointer to the structure */
+#define ZERO_STRUCTP(x) memset((char *)(x), 0, sizeof(*(x)))
+
+/* zero an array - note that sizeof(array) must work - ie. it must not be a
+ pointer */
#define ZERO_ARRAY(x) memset((char *)(x), 0, sizeof(x))
+
#define SMB_ASSERT(b) ((b)?(void)0: \
(DEBUG(0,("PANIC: assert failed at %s(%d)\n", \
__FILE__, __LINE__)), smb_panic("assert failed")))