Make it compile in C++ mode.
authorBruno Haible <bruno@clisp.org>
Wed, 1 Nov 2006 20:30:39 +0000 (20:30 +0000)
committerBruno Haible <bruno@clisp.org>
Wed, 1 Nov 2006 20:30:39 +0000 (20:30 +0000)
ChangeLog
lib/printf-parse.c

index 14955b0..36c5dac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-11-01  Bruno Haible  <bruno@clisp.org>
+
+       * lib/printf-parse.c (PRINTF_PARSE): Cast malloc/realloc results.
+
 2006-11-01  Eric Blake  <ebb9@byu.net>
 
        * lib/mkstemp-safer.c (mkstemp_safer): Allow C++ compilation.
index bd8caf9..9a86f77 100644 (file)
@@ -68,7 +68,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
 
   d->count = 0;
   d_allocated = 1;
-  d->dir = malloc (d_allocated * sizeof (DIRECTIVE));
+  d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
   if (d->dir == NULL)
     /* Out of memory.  */
     return -1;
@@ -92,9 +92,9 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
        if (size_overflow_p (memory_size))                              \
          /* Overflow, would lead to out of memory.  */                 \
          goto error;                                                   \
-       memory = (a->arg                                                \
-                 ? realloc (a->arg, memory_size)                       \
-                 : malloc (memory_size));                              \
+       memory = (argument *) (a->arg                                   \
+                              ? realloc (a->arg, memory_size)          \
+                              : malloc (memory_size));                 \
        if (memory == NULL)                                             \
          /* Out of memory.  */                                         \
          goto error;                                                   \
@@ -515,7 +515,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
              if (size_overflow_p (memory_size))
                /* Overflow, would lead to out of memory.  */
                goto error;
-             memory = realloc (d->dir, memory_size);
+             memory = (DIRECTIVE *) realloc (d->dir, memory_size);
              if (memory == NULL)
                /* Out of memory.  */
                goto error;