changeset 7596:49c1c5e086f4

Make it compile in C++ mode.
author Bruno Haible <bruno@clisp.org>
date Wed, 01 Nov 2006 20:30:39 +0000
parents d96b2147d668
children 99135a4b8955
files ChangeLog lib/printf-parse.c
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -68,7 +68,7 @@
 
   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 @@
 	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 @@
 	      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;