[PATCH] refactor correct_password.c to avoid one #if
Tito
farmatito at tiscali.it
Wed Aug 1 12:01:23 UTC 2012
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
More information about the busybox
mailing list