summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 270bb3e)
raw | patch | inline | side by side (parent: 270bb3e)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 31 Jul 2007 04:53:04 +0000 (04:53 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 31 Jul 2007 04:53:04 +0000 (04:53 +0000) |
program/bindings/ruby/main.c | patch | blob | history |
index d7618ee5b73725b67e988ab297d1d37066abd0ad..c5cf79effdfcb7569ea32812ff6e043b477baa27 100644 (file)
return result;
}
-VALUE rb_rrd_info(VALUE self, VALUE args)
+VALUE rb_rrd_info(
+ VALUE self,
+ VALUE args)
{
string_arr a;
- info_t *p, *data;
- VALUE result;
+ info_t *p, *data;
+ VALUE result;
a = string_arr_new(args);
data = rrd_info(a.len, a.strings);
string_arr_delete(a);
- RRD_CHECK_ERROR
-
- result = rb_hash_new();
+ RRD_CHECK_ERROR result = rb_hash_new();
while (data) {
- VALUE key = rb_str_new2(data->key);
+ VALUE key = rb_str_new2(data->key);
+
switch (data->type) {
case RD_I_VAL:
if (isnan(data->value.u_val)) {
rb_hash_aset(result, key, Qnil);
- }
- else {
+ } else {
rb_hash_aset(result, key, rb_float_new(data->value.u_val));
}
break;