summaryrefslogtreecommitdiff
path: root/include/nasmlib.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2017-03-31 14:56:17 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2017-03-31 14:56:17 -0700
commite886c0e9683884b51740d0b3aa3a11f023fdbe04 (patch)
tree0127be30d4e1b087fdb5c5f6ceb95dd02ffc8108 /include/nasmlib.h
parent1980abfb7a1f26bf73a796bafa514190bc370a59 (diff)
downloadnasm-e886c0e9683884b51740d0b3aa3a11f023fdbe04.tar.gz
Change nasm_zero() to pass an object, not a pointer
Passing an object to nasm_zero() allows us to use it on arrays. Otherwise the array will decay to a pointer and silently clear only the first member of the array! Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'include/nasmlib.h')
-rw-r--r--include/nasmlib.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/nasmlib.h b/include/nasmlib.h
index 8df71bc5..4d241f0d 100644
--- a/include/nasmlib.h
+++ b/include/nasmlib.h
@@ -97,7 +97,7 @@ char * safe_alloc nasm_strndup(const char *, size_t);
nasm_free(*_pp); \
*_pp = NULL; \
} while (0)
-#define nasm_zero(p) (memset((p), 0, sizeof(*(p))))
+#define nasm_zero(x) (memset(&(x), 0, sizeof(x)))
#define nasm_zeron(p,n) (memset((p), 0, (n)*sizeof(*(p))))
/*