[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] refactor correct_password.c to avoid one #if
From:       Tito <farmatito () tiscali ! it>
Date:       2012-08-01 12:01:23
Message-ID: 201208011401.23599.farmatito () tiscali ! it
[Download RAW message or body]

On Wednesday 01 August 2012 09:39:56 Ralf Friedl wrote:
> Tito wrote:
> > On Tuesday 31 July 2012 18:08:15 walter harms wrote:
> >   
> >> @@ -55,7 +49,10 @@ int FAST_FUNC correct_password(const struct passwd *pw)
> >>  	}
> >>  	correct = pw->pw_passwd;
> >>  #if ENABLE_FEATURE_SHADOWPASSWDS
> >> +	/* Using _r function to avoid pulling in static buffers */
> >>  	if ((correct[0] == 'x' || correct[0] == '*') && !correct[1]) {
> >> +		struct spwd spw;
> >> +		char buffer[256];
> >>  		/* getspnam_r may return 0 yet set result to NULL.
> >>  		 * At least glibc 2.4 does this. Be extra paranoid here. */
> >>  		struct spwd *result = NULL
> > I personally I'm not for mixing variable declarations and code,
> > I admit tough that in this case as it are just a few lines it could be ok.
> The "struct spwd *result" is already declared inside the block, so it's 
> just consequent to move the other declarations there, too.
> 
> I personally like to have the variables declared in the block where they 
> are used, because it makes it immediately clear to the reader that they 
> are used only in that block.
> 
> Ralf
> 
Hi,
"De gustibus non disputandum est"

Ciao,
Tito
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic