nasmlib.h: add a nasm_zero() macro to the pointer helpers
We do have a number of places where we had problems doing things like: memset(foo, 0, sizeof foo) instead of sizeof *foo. Add a helper macro nasm_zero() to the list of (sadly not yet well used) pointer-safe helper macros. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
94e4052a8a
commit
5d7fdc1962
1 changed files with 1 additions and 0 deletions
|
@ -156,6 +156,7 @@ char * safe_alloc nasm_strndup(const char *, size_t);
|
|||
#define nasm_new(p) ((p) = nasm_zalloc(sizeof(*(p))))
|
||||
#define nasm_newn(p,n) ((p) = nasm_calloc(sizeof(*(p)),(n)))
|
||||
#define nasm_delete(p) do { nasm_free(p); (p) = NULL; } while (0)
|
||||
#define nasm_zero(p) (memset((p), 0, sizeof(*(p))))
|
||||
|
||||
/*
|
||||
* Wrapper around fwrite() which fatal-errors on output failure.
|
||||
|
|
Loading…
Reference in a new issue