[PATCH] Fix string to integer conversion

Ralph Böhme slow at samba.org
Fri Feb 22 21:51:43 UTC 2019


On Fri, Feb 22, 2019 at 01:42:12PM -0800, Jeremy Allison via samba-technical wrote:
>One small thing:
>
>In a couple of places you have:
>
>+               int error;
>
>I'd prefer you initialize that to zero at declaration
>time, i.e.:
>
>+               int error = 0;
>
>Now I know both strtoul_err() and strtoull_err()
>will return zero there on success (arguably
>they shouldn't touch &error on success, but
>I'm not going to fight that battle :-), but
>it's good habits (and I think in the README.Coding)
>standards that we initialize on declaration if
>possible.

this goes for pointers, not for non-pointers. Imho the latter should only be 
initialized when needed.

-slow

-- 
Ralph Boehme, Samba Team                https://samba.org/
Samba Developer, SerNet GmbH   https://sernet.de/en/samba/
GPG-Fingerprint   FAE2C6088A24252051C559E4AA1E9B7126399E46



More information about the samba-technical mailing list