[SSSD] [PATCH] Backward GOTOs rewritten into do-while loops.

Ondrej Kos okos at redhat.com
Wed Aug 8 06:56:59 UTC 2012


Strange, I've created the patch with this alias, so patience flag should 
be on
alias gfp='git format-patch -M -C --patience --full-index'

As for the while -> do-while, if I'd do that, then it would need another 
condition
if (status == NSS_STATUS_TRYAGAIN)
for the block of code which adjusts buffer size on lines 1250-1263. It 
seemed a bit pointless when you can use just one condition in while. So, 
should i leave it this way, or really use do-while with additional if?

Ondrej

On 08/07/2012 03:58 PM, Simo Sorce wrote:
> One comment and one nitpick.
>
> Comment: polease use --patience flag to git format-patch so that the
> patches are more readable.
>
> Nitpick:
>
> On Tue, 2012-08-07 at 15:26 +0200, Ondrej Kos wrote:
>> -                                     &num, &gids, limit, &ret);
>> -    switch (status) {
>> -    case NSS_STATUS_TRYAGAIN:
>> +    while ( (status = ctx->ops.initgroups_dyn(pwd->pw_name,
>> pwd->pw_gid,
>> +                                    &num_gids, &num, &gids, limit,
>> &ret))
>> +                                    == NSS_STATUS_TRYAGAIN) {
>>           /* buffer too small ? */
>
> here please use a do/whiel loop to make code more readable:
>
> do {
> 	status = ctx->ops.initgrou ...
>
> } while (status == NSS_STATUS_TRYAGAIN);
>
>
> Simo.
>
>


-- 
Ondrej Kos
Associate Software Engineer
Identity Management
Red Hat Czech

cell:  +420-736-417-909
phone: +420-532-294-558
ext.:  82-62558
irc:   okos @ #brno



More information about the sssd-devel mailing list