summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e48179)
raw | patch | inline | side by side (parent: 3e48179)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 6 Oct 2015 18:01:27 +0000 (20:01 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 6 Oct 2015 18:01:27 +0000 (20:01 +0200) |
That is, allow to emit store objects to an incomplete writer as long as all
required callbacks are present.
required callbacks are present.
src/core/store_json.c | patch | blob | history |
diff --git a/src/core/store_json.c b/src/core/store_json.c
index 4fd309b3ec4ac6fa81f982fd9e71b2d3226d0af7..961e54c0606ae84206d1199758506ad4ff212cbf 100644 (file)
--- a/src/core/store_json.c
+++ b/src/core/store_json.c
int
sdb_store_emit(sdb_store_obj_t *obj, sdb_store_writer_t *w, sdb_object_t *wd)
{
- if ((! obj) || (! w)
- || (! w->store_host) || (! w->store_service)
- || (! w->store_metric) || (! w->store_attribute))
+ if ((! obj) || (! w))
return -1;
switch (obj->type) {
(const char * const *)obj->backends,
obj->backends_num,
};
+ if (! w->store_host)
+ return -1;
return w->store_host(&host, wd);
}
case SDB_SERVICE:
(const char * const *)obj->backends,
obj->backends_num,
};
+ if (! w->store_service)
+ return -1;
return w->store_service(&service, wd);
}
case SDB_METRIC:
(const char * const *)obj->backends,
obj->backends_num,
};
+ if (! w->store_metric)
+ return -1;
return w->store_metric(&metric, wd);
}
case SDB_ATTRIBUTE:
if (obj->parent && (obj->parent->type != SDB_HOST)
&& obj->parent->parent)
attr.hostname = obj->parent->parent->_name;
+ if (! w->store_attribute)
+ return -1;
return w->store_attribute(&attr, wd);
}
}