[lvm-devel] [PATCH 02/29] Fix check for empty system_dir

Petr Rockai prockai at redhat.com
Fri Nov 26 07:35:12 UTC 2010


Zdenek Kabelac <zkabelac at redhat.com> writes:

> Dne 25.11.2010 18:19, Petr Rockai napsal(a):
>> Zdenek Kabelac <zkabelac at redhat.com> writes:
>> 
>>> Fixing most probably a typo - I assume original intention has been
>>> to check for zero length string.
>> 
>> In that case, please use !strlen(str), as that is much more readable.
>> 
>
> In this case I believe it's common practice not only in our source to check
> the first char for '\0' when checking for empty string - so are we planning to
> replace in other places in lvm code - then I'd propose probably some nice
> macro  empty_string() or whatever name we could think of?

Maybe go for !str[0] at least. But strempty sounds reasonable, IMHO. On
the other hand, I am not extremely happy with the use of ! instead of ==
0, either. I know, it's the preferred style in LVM...

Anyway, nevermind. Do as you think. :) The patch is technically OK and
it doesn't make sense to hold it back on style.

Yours,
   Petr.




More information about the lvm-devel mailing list