mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
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>
This commit is contained in:
parent
1980abfb7a
commit
e886c0e968
@ -546,7 +546,7 @@ int64_t assemble(int32_t segment, int64_t start, int bits, insn *instruction)
|
||||
int32_t itimes;
|
||||
int64_t wsize; /* size for DB etc. */
|
||||
|
||||
nasm_zero(&data);
|
||||
nasm_zero(data);
|
||||
data.offset = start;
|
||||
data.segment = segment;
|
||||
data.itemp = NULL;
|
||||
|
@ -169,7 +169,7 @@ void process_pragma(char *str)
|
||||
struct pragma pragma;
|
||||
char *p;
|
||||
|
||||
nasm_zero(&pragma);
|
||||
nasm_zero(pragma);
|
||||
|
||||
pragma.facility_name = nasm_get_word(str, &p);
|
||||
if (!pragma.facility_name) {
|
||||
|
@ -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))))
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user