[rrd-developers] [PATCH] Fix checking for "simple integers"

Tobias Oetiker tobi at oetiker.ch
Thu Jan 14 14:02:00 CET 2010


Today Florian Forster wrote:

> Hi,
>
> in src/rrd_update.c there is this code (which is checking for "simple
> integers"):
>
>   if ( (   updvals[ds_idx + 1][0] < '0'
>         || updvals[ds_idx + 1][0] > '9' )
>        && updvals[ds_idx + 1][0] != '-'
>        && updvals[ds_idx + 1][0] != 'U'
>        && updvals[ds_idx + 1][0] == '\0'
>      ) { ... }
>
> If you look closely, you notice that this is the same as saying:
>
>   if (updvals[ds_idx + 1][0] == '\0') { ... }
>
> I've written a small patch which changes the behavior to what I assume is
> intended and is hopefully a good deal easier to read than the existing check.

indeed ... neat patch ... thanks
tobi

>
> Regards,
> -octo
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-developers mailing list