Re: [PATCH] Fix checking for "simple integers"

Tobias Oetiker <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <[email protected]>
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 [email protected] ++41 62 775 9902 / sb: -9900
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.