[PATCH] compile option: fix -std=c99,gnu99 errors in mingw

walter harms wharms at bfs.de
Fri Dec 17 08:20:12 UTC 2010



Am 17.12.2010 04:43, schrieb Macpaul Lin:
> Fix variable declaration in for loop.
> Update files:
>   miscutils/chat.c
> 
> Variable declaration in for loop will cause compile error
> when build busybox in MinGW environment.
> 
> Signed-off-by: Macpaul Lin <macpaul at andestech.com>
> ---
>  miscutils/chat.c     |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/miscutils/chat.c b/miscutils/chat.c
> index 3ffd7b2..f850f92 100644
> --- a/miscutils/chat.c
> +++ b/miscutils/chat.c
> @@ -180,7 +180,8 @@ int chat_main(int argc UNUSED_PARAM, char **argv)
>  #if ENABLE_FEATURE_CHAT_VAR_ABORT_LEN
>  				max_abort_len = 0;
>  #endif
> -				for (llist_t *l = aborts; l; l = l->link) {
> +				llist_t *l = NULL;
> +				for (l = aborts; l; l = l->link) {
>  #if ENABLE_FEATURE_CHAT_VAR_ABORT_LEN
>  					size_t len = strlen(l->data);
>  #endif

this looks reasonable,
ntl i am a bit fan of "define variables early" perhaps the declaration
should be at function start. btw why these = NULL ? one line later
it becomes l=aborts.

just my 2 cents,
 wh


More information about the busybox mailing list