[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to gnats/libiberty/vasprintf.c
From: |
Milan Zamazal |
Subject: |
Changes to gnats/libiberty/vasprintf.c |
Date: |
Mon, 10 Dec 2001 18:04:32 -0500 |
Index: gnats/libiberty/vasprintf.c
diff -c gnats/libiberty/vasprintf.c:1.2 gnats/libiberty/vasprintf.c:1.3
*** gnats/libiberty/vasprintf.c:1.2 Tue Oct 26 03:10:16 1999
--- gnats/libiberty/vasprintf.c Mon Dec 10 18:03:26 2001
***************
*** 18,38 ****
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
! #ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
#include <string.h>
! #include <ansidecl.h>
#ifdef TEST
int global_total_width;
#endif
! unsigned long strtoul ();
! char *malloc ();
static int
int_vasprintf (result, format, args)
--- 18,48 ----
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
! #ifdef HAVE_CONFIG_H
! #include "config.h"
! #endif
! #include <ansidecl.h>
! #ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
#include <string.h>
! #ifdef HAVE_STDLIB_H
! #include <stdlib.h>
! #else
! extern unsigned long strtoul ();
! extern PTR malloc ();
! #endif
! #include "libiberty.h"
#ifdef TEST
int global_total_width;
#endif
!
! static int int_vasprintf PARAMS ((char **, const char *, va_list *));
static int
int_vasprintf (result, format, args)
***************
*** 60,66 ****
total_width += abs (va_arg (ap, int));
}
else
! total_width += strtoul (p, &p, 10);
if (*p == '.')
{
++p;
--- 70,76 ----
total_width += abs (va_arg (ap, int));
}
else
! total_width += strtoul (p, (char **) &p, 10);
if (*p == '.')
{
++p;
***************
*** 70,76 ****
total_width += abs (va_arg (ap, int));
}
else
! total_width += strtoul (p, &p, 10);
}
while (strchr ("hlL", *p))
++p;
--- 80,86 ----
total_width += abs (va_arg (ap, int));
}
else
! total_width += strtoul (p, (char **) &p, 10);
}
while (strchr ("hlL", *p))
++p;
***************
*** 105,110 ****
--- 115,121 ----
(void) va_arg (ap, char *);
break;
}
+ p++;
}
}
#ifdef TEST
***************
*** 131,163 ****
}
#ifdef TEST
! void
! checkit
! #ifdef __STDC__
! (const char* format, ...)
! #else
! (va_alist)
! va_dcl
! #endif
{
va_list args;
char *result;
! #ifdef __STDC__
! va_start (args, format);
! #else
! char *format;
! va_start (args);
! format = va_arg (args, char *);
#endif
vasprintf (&result, format, args);
! if (strlen (result) < global_total_width)
printf ("PASS: ");
else
printf ("FAIL: ");
printf ("%d %s\n", global_total_width, result);
}
int
main ()
{
--- 142,174 ----
}
#ifdef TEST
! static void checkit PARAMS ((const char *, ...));
!
! static void
! checkit VPARAMS ((const char* format, ...))
{
va_list args;
char *result;
+ #ifndef ANSI_PROTOTYPES
+ const char *format;
+ #endif
! VA_START (args, format);
!
! #ifndef ANSI_PROTOTYPES
! format = va_arg (args, const char *);
#endif
+
vasprintf (&result, format, args);
! if (strlen (result) < (size_t) global_total_width)
printf ("PASS: ");
else
printf ("FAIL: ");
printf ("%d %s\n", global_total_width, result);
}
+ extern int main PARAMS ((void));
+
int
main ()
{
***************
*** 168,172 ****
--- 179,185 ----
checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
777777777777777777333333333333366666666666622222222222777777777777733333");
checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
+
+ return 0;
}
#endif /* TEST */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to gnats/libiberty/vasprintf.c,
Milan Zamazal <=