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

Florian Forster rrdtool at nospam.verplant.org
Thu Jan 14 10:09:14 CET 2010


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.

Regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rrdtool-simple-integer-r1999.patch
Type: text/x-diff
Size: 2089 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20100114/680b0075/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20100114/680b0075/attachment.pgp 


More information about the rrd-developers mailing list