diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-08-30 04:30:57 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-08-30 04:30:57 +0000 |
commit | d3dda65d5177154e2128f50ca3dd34e8e13b6b08 (patch) | |
tree | b1e3be7b9b38868d37fa7500b04f5ad1f9df0e1e /source/include/smb.h | |
parent | c5e5c25c854e54f59291057ba47c4701b5910ebe (diff) | |
download | samba-d3dda65d5177154e2128f50ca3dd34e8e13b6b08.tar.gz samba-d3dda65d5177154e2128f50ca3dd34e8e13b6b08.tar.xz samba-d3dda65d5177154e2128f50ca3dd34e8e13b6b08.zip |
changed the size of a char array in the userdata_struct from 1 to 16
to account for padding/alignment issues. Eventually I'd like to find a
way to get rid of this construct altogether as it is a bit error
prone and hard to debug.
also added a new macro:
ZERO_STRUCTP() that takes a pointer to a structure and zeros the
structure. Used in nmbd to zero allocated structures before freeing
them to try to catch bugs a bit faster.
Diffstat (limited to 'source/include/smb.h')
-rw-r--r-- | source/include/smb.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/include/smb.h b/source/include/smb.h index b615d097083..90435b208e3 100644 --- a/source/include/smb.h +++ b/source/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"))) |