Hi,

attached patch kills a global variable, and makes vsprintf reentrant and work without requiring .bss space.
Make vsprintf reentrant. More importantly, eliminate global variable.

Signed-off-by: Patrick Georgi <[email protected]>
Index: src/console/vsprintf.c
===================================================================
--- src/console/vsprintf.c      (Revision 1725)
+++ src/console/vsprintf.c      (Arbeitskopie)
@@ -15,20 +15,16 @@
 
-/* FIXME this global makes vsprintf non-reentrant */
-
-static char *str_buf;
-static void str_tx_byte(unsigned char byte)
-{
-       *str_buf = byte;
-       str_buf++;
-}
-
 int vsprintf(char * buf, const char *fmt, va_list args)
 {
+       char *str_buf;
+       void str_tx_byte(unsigned char byte)
+       {
+               *str_buf = byte;
+               str_buf++;
+       }
+
        int i;
        str_buf = buf;
        i = vtxprintf(str_tx_byte, fmt, args);
-       /* maeder/Ispiri -- The null termination was missing a deference */
-       /*                  and was just zeroing out the pointer instead */
        *str_buf = '\0';
        return i;
 }
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to