[PATCH 1/3] Remove unnesessory malloc.h inclusions.

Sascha Hauer s.hauer at pengutronix.de
Mon Jun 3 03:24:27 EDT 2013


On Sun, Jun 02, 2013 at 11:53:47PM +0900, Masaki Muranaka wrote:
> ---
> diff --git a/common/resource.c b/common/resource.c
> index 5795e79..954357e 100644
> --- a/common/resource.c
> +++ b/common/resource.c
> @@ -16,7 +16,6 @@
>   * GNU General Public License for more details.
>   */
>  #include <common.h>
> -#include <malloc.h>
>  #include <errno.h>
>  #include <init.h>
>  #include <linux/ioport.h>

Applying this patch leads to several compiler warnings:

common/resource.c: In function 'release_region':
common/resource.c:105:2: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
commands/readline.c: In function 'do_readline':
commands/readline.c:33:3: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
commands/time.c: In function 'do_time':
commands/time.c:41:2: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
commands/oftree.c: In function 'do_oftree':
commands/oftree.c:197:2: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
commands/readlink.c: In function 'do_readlink':
commands/readlink.c:58:3: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
commands/global.c: In function 'globalvar_set':
commands/global.c:34:3: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]

So indeed we do not use malloc in these files, but we still use free.
I think you would have to replace the includes with #include <stdlib.h>
rather than removing them completely.

Sascha

-- 
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 |



More information about the barebox mailing list