summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5ff5059)
raw | patch | inline | side by side (parent: 5ff5059)
author | Florian Forster <octo@huhu.verplant.org> | |
Wed, 1 Jul 2009 09:18:52 +0000 (11:18 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Wed, 1 Jul 2009 13:41:52 +0000 (15:41 +0200) |
src/plugin.h | patch | blob | history | |
src/utils_db_query.c | patch | blob | history |
diff --git a/src/plugin.h b/src/plugin.h
index 0ccb198c90e9d4bdd2eccdf2ec9486f0017639bc..b35fcf189874b452aff00c03138ec068db54b36a 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
#define DS_TYPE_DERIVE 2
#define DS_TYPE_ABSOLUTE 3
+#define DS_TYPE_TO_STRING(t) (t == DS_TYPE_COUNTER) ? "counter" : \
+ (t == DS_TYPE_GAUGE) ? "gauge" : \
+ (t == DS_TYPE_DERIVE) ? "derive" : \
+ (t == DS_TYPE_ABSOLUTE) ? "absolute" : \
+ "unknown"
+
+
#ifndef LOG_ERR
# define LOG_ERR 3
#endif
diff --git a/src/utils_db_query.c b/src/utils_db_query.c
index 9a211b4dbecf247077f00129c4a14ed86527c7bc..5f892a408b0c49f14e4560ad34100bfadfa0f398 100644 (file)
--- a/src/utils_db_query.c
+++ b/src/utils_db_query.c
{
ERROR ("db query utils: udb_legacy_result_handle_result: "
"Parsing `%s' as %s failed.", value_str,
- (r->ds->ds[0].type == DS_TYPE_COUNTER) ? "counter" : "gauge");
+ DS_TYPE_TO_STRING (r->ds->ds[0].type));
errno = EINVAL;
return (-1);
}
if (0 != parse_value (value_str, &vl.values[i], r->ds->ds[i].type))
{
ERROR ("db query utils: udb_result_submit: Parsing `%s' as %s failed.",
- value_str,
- (r->ds->ds[i].type == DS_TYPE_COUNTER) ? "counter" : "gauge");
+ value_str, DS_TYPE_TO_STRING (r->ds->ds[i].type));
errno = EINVAL;
return (-1);
}