Re: [Grubby - PATCH 4/4] Avoid C99 declaration inside for-loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/11/2012 12:29 PM, Adrian Perez wrote:
> Avoids declaring an integer variable inside the initializer of a for-loop.
> This patch avoids needing to compile the source in C99 mode.

Er, why?  The c99 way is *better*, and we can easily compile in C99 mode.

> ---
>  grubby.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/grubby.c b/grubby.c
> index 4866f1d..d0101cd 100644
> --- a/grubby.c
> +++ b/grubby.c
> @@ -2423,9 +2423,10 @@ static void requote(struct singleLine *tmplLine, struct configFileInfo * cfi)
>  	    quoteLen += strlen(tmplLine->elements[j].indent);
>  	    
>  	    if (isquote(tmplLine->elements[j].item[itemlen - 1])) {
> +		int i;
>  		c = malloc(quoteLen + 1);
>  		c[0] = '\0';
> -		for (int i = firstQuotedItem; i < j+1; i++) {
> +		for (i = firstQuotedItem; i < j+1; i++) {
>  		    strcat(c, tmplLine->elements[i].item);
>  		    strcat(c, tmplLine->elements[i].indent);
>  		}


-- 
        Peter

Computer games don't affect kids; I mean if Pac-Man affected us as
kids, we'd all be running around in darkened rooms, munching magic
pills and listening to repetitive electronic music.
		-- Not actually Kristian Wilson, Nintendo, Inc, 1989

01234567890123456789012345678901234567890123456789012345678901234567890123456789

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux