From 64c883a32013ebfe2624fe6ec0ed0f5a9de3a716 Mon Sep 17 00:00:00 2001 From: Matheus Afonso Martins Moreira Date: Thu, 2 Nov 2023 05:58:47 -0300 Subject: [PATCH] vcscanf: move buffer variables to top of function This buffer is currently used only when decoding strings. Place it at the top level so other code can also use it. Ensure it is initialized to NULL. --- libc/stdio/vcscanf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/stdio/vcscanf.c b/libc/stdio/vcscanf.c index 80373886b..50850cbbb 100644 --- a/libc/stdio/vcscanf.c +++ b/libc/stdio/vcscanf.c @@ -60,6 +60,8 @@ int __vcscanf(int callback(void *), // struct FreeMe *next; void *ptr; } *freeme = NULL; + void *buf = NULL; + size_t bufsize; const unsigned char *p = (const unsigned char *)fmt; int *n_ptr; int items = 0; @@ -84,8 +86,6 @@ int __vcscanf(int callback(void *), // break; case '%': { uint128_t number; - void *buf; - size_t bufsize; unsigned width = 0; unsigned char bits = 32; unsigned char charbytes = sizeof(char);