mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] dlmalloc: fix compiler warning
@ 2013-11-07  5:46 Alexander Aring
  2013-11-07  7:10 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Aring @ 2013-11-07  5:46 UTC (permalink / raw)
  To: barebox

This patch fix a compiler warning while building sandbox barebox with
gcc version 4.8.2.

common/dlmalloc.c: In function ‘barebox_calloc’:
common/dlmalloc.c:1756:2: warning: ISO C90 forbids mixed declarations
and code [-Wdeclaration-after-statement]
  void *mem = malloc(sz);
  ^

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 common/dlmalloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index b4341fe..f006206 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1745,6 +1745,7 @@ void *calloc(size_t n, size_t elem_size)
 	mchunkptr p;
 	INTERNAL_SIZE_T csz;
 	INTERNAL_SIZE_T sz = n * elem_size;
+	void *mem;
 
 	/* check if expand_top called, in which case don't need to clear */
 	mchunkptr oldtop = top;
@@ -1753,7 +1754,7 @@ void *calloc(size_t n, size_t elem_size)
 	if ((long)n < 0)
 		return NULL;
 
-	void *mem = malloc(sz);
+	mem = malloc(sz);
 
 	if (!mem)
 		return NULL;
-- 
1.8.4.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dlmalloc: fix compiler warning
  2013-11-07  5:46 [PATCH] dlmalloc: fix compiler warning Alexander Aring
@ 2013-11-07  7:10 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-11-07  7:10 UTC (permalink / raw)
  To: Alexander Aring; +Cc: barebox

On Thu, Nov 07, 2013 at 06:46:00AM +0100, Alexander Aring wrote:
> This patch fix a compiler warning while building sandbox barebox with
> gcc version 4.8.2.
> 
> common/dlmalloc.c: In function ‘barebox_calloc’:
> common/dlmalloc.c:1756:2: warning: ISO C90 forbids mixed declarations
> and code [-Wdeclaration-after-statement]
>   void *mem = malloc(sz);
>   ^
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>

Applied, thanks

Sascha

> ---
>  common/dlmalloc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/common/dlmalloc.c b/common/dlmalloc.c
> index b4341fe..f006206 100644
> --- a/common/dlmalloc.c
> +++ b/common/dlmalloc.c
> @@ -1745,6 +1745,7 @@ void *calloc(size_t n, size_t elem_size)
>  	mchunkptr p;
>  	INTERNAL_SIZE_T csz;
>  	INTERNAL_SIZE_T sz = n * elem_size;
> +	void *mem;
>  
>  	/* check if expand_top called, in which case don't need to clear */
>  	mchunkptr oldtop = top;
> @@ -1753,7 +1754,7 @@ void *calloc(size_t n, size_t elem_size)
>  	if ((long)n < 0)
>  		return NULL;
>  
> -	void *mem = malloc(sz);
> +	mem = malloc(sz);
>  
>  	if (!mem)
>  		return NULL;
> -- 
> 1.8.4.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-07  7:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-07  5:46 [PATCH] dlmalloc: fix compiler warning Alexander Aring
2013-11-07  7:10 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox