]> pd.if.org Git - pdclib/commitdiff
Compacted initializing of status struct.
authorsolar <unknown>
Fri, 14 May 2010 22:07:08 +0000 (22:07 +0000)
committersolar <unknown>
Fri, 14 May 2010 22:07:08 +0000 (22:07 +0000)
functions/stdio/vfprintf.c
functions/stdio/vfscanf.c
functions/stdio/vsnprintf.c
functions/stdio/vsscanf.c

index 626ad516302cf439116c6ba4592dcd33e54b5ba1..14e666a63e2357a5af43062aa7f7710f2404b5de 100644 (file)
 int vfprintf( struct _PDCLIB_file_t * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, va_list arg )
 {
     /* TODO: This function should interpret format as multibyte characters.  */
-    /* Members: base, flags, n, i, current, s, width, prec, stream, arg         */
-    struct _PDCLIB_status_t status;
-    status.base = 0;
-    status.flags = 0;
-    status.n = SIZE_MAX;
-    status.i = 0;
-    status.current = 0;
-    status.s = NULL;
-    status.width = 0;
-    status.prec = 0;
-    status.stream = stream;
+    /* base, flags, n, i, current, s, width, prec, stream, arg */
+    struct _PDCLIB_status_t status = { 0, 0, SIZE_MAX, 0, 0, NULL, 0, 0, stream, NULL };
     va_copy( status.arg, arg );
+
     while ( *format != '\0' )
     {
         const char * rc;
index bf09226c16edb26b77e1b4355f064e236afbec40..16ea59283ef520755a1fecf6b31e18b4ef48febe 100644 (file)
 
 int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, va_list arg )
 {
-    struct _PDCLIB_status_t status;
-    status.base = 0;
-    status.flags = 0;
-    status.n = 0; 
-    status.i = 0;
-    status.current = 0;
-    status.s = NULL;
-    status.width = 0;
-    status.prec = 0;
-    status.stream = stream;
-    // = { 0, 0, 0, 0, 0, NULL, 0, 0, stream }
+    /* base, flags, n, i, current, s, width, prec, stream, arg */
+    struct _PDCLIB_status_t status = { 0, 0, 0, 0, 0, NULL, 0, 0, stream, NULL };
     va_copy( status.arg, arg );
     while ( *format != '\0' )
     {
index 4dbd7c27cfb03679a366558346ddb8d942b6bf8c..dee30dcea6f5e7b202fea93494d580d0de7da11b 100644 (file)
 
 int vsnprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg )
 {
-    /* TODO: This function should interpret format as multibyte characters.  */
-    /* Members: base, flags, n, i, current, s, width, prec, stream, arg         */
-    struct _PDCLIB_status_t status;
-    status.base = 0;
-    status.flags = 0;
-    status.n = n;
-    status.i = 0;
-    status.current = 0;
-    status.s = s;
-    status.width = 0;
-    status.prec = 0;
-    status.stream = NULL;
+    /* base, flags, n, i, current, s, width, prec, stream, arg */
+    struct _PDCLIB_status_t status = { 0, 0, n, 0, 0, s, 0, 0, NULL, NULL };
     va_copy( status.arg, arg );
-    // = { 0, 0, n, 0, 0, s, 0, 0, NULL };
+
     while ( *format != '\0' )
     {
         const char * rc;
index b494da1fdcb54ce9b580d1f43b399625e59f70a7..20893c97a7b6251f9c30beb49b0e766b181eddc6 100644 (file)
 
 int vsscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, va_list arg )
 {
-    struct _PDCLIB_status_t status;
-    status.base = 0;
-    status.flags = 0;
-    status.n = 0; 
-    status.i = 0;
-    status.current = 0;
-    status.s = (char *)s;
-    status.width = 0;
-    status.prec = 0;
-    status.stream = NULL;
+    /* base, flag, n, i, current, s, width, prec, stream, arg */
+    struct _PDCLIB_status_t status = { 0, 0, 0, 0, 0, (char *)s, 0, 0, NULL, NULL };
     va_copy( status.arg, arg );
+
     while ( *format != '\0' )
     {
         const char * rc;