Skip to content

Commit 57025bd

Browse files
committed
ext/standard/scanf: use memset to initialize array of 0s
1 parent 9003847 commit 57025bd

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/standard/scanf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,7 @@ static int ValidateFormat(char *format, uint32_t numVars, uint32_t *totalSubs)
328328
nassign = safe_emalloc(sizeof(uint32_t), numVars, 0);
329329
nspace = numVars;
330330
}
331-
for (i = 0; i < nspace; i++) {
332-
nassign[i] = 0;
333-
}
331+
memset(nassign, 0, sizeof(uint32_t)*numVars);
334332

335333
while (*format != '\0') {
336334
ch = format++;

0 commit comments

Comments
 (0)