From 66675a0e6945769a41e238d300ddcecfec6089d5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 1 Nov 2006 20:30:39 +0000 Subject: [PATCH] Make it compile in C++ mode. --- ChangeLog | 4 ++++ lib/printf-parse.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14955b0bcf..36c5dac712 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-11-01 Bruno Haible + + * lib/printf-parse.c (PRINTF_PARSE): Cast malloc/realloc results. + 2006-11-01 Eric Blake * lib/mkstemp-safer.c (mkstemp_safer): Allow C++ compilation. diff --git a/lib/printf-parse.c b/lib/printf-parse.c index bd8caf9f44..9a86f7738e 100644 --- a/lib/printf-parse.c +++ b/lib/printf-parse.c @@ -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; -- 2.30.2