Hi Chris,

On Thu, Feb 04, 2010 at 12:52:30AM -0800, Chris Buben wrote:
> I'm deserializing JSON output from the write_http plugin using ruby-yajl.
> yajl was puking on the literal value nan encoded in the output.

thanks for your patch :) I think it's kind of weird that JSON doesn't
differentiate between -inf, inf and nan, but since that's what the
standard says, that's what we should be doing.

> -      BUFFER_ADD ("%g", vl->values[i].gauge);
> +    {
> +      if(isnan(vl->values[i].gauge) || isinf(vl->values[i].gauge))
> +        BUFFER_ADD ("null");
> +      else
> +        BUFFER_ADD ("%g", vl->values[i].gauge);
> +    }

I'm a bit uncomfortable using "isinf" here. We've had a great deal of
trouble with "isnan". Since "isinf" isn't used anywhere else and the C99
standard says it is a macro, I'll change this to:

  #ifdef isinf
    if (isnan (value) || isinf (value))
  #else
    if (isnan (value))
  #endif

Does this sound alright to you?

Regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/

Attachment: signature.asc
Description: Digital signature

_______________________________________________
collectd mailing list
[email protected]
http://mailman.verplant.org/listinfo/collectd

Reply via email to