summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c4da209)
raw | patch | inline | side by side (parent: c4da209)
author | Brian Kelly <brianpkelly46@gmail.com> | |
Wed, 15 Jul 2015 15:40:18 +0000 (11:40 -0400) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 27 Oct 2015 22:28:15 +0000 (23:28 +0100) |
src/write_redis.c | patch | blob | history |
diff --git a/src/write_redis.c b/src/write_redis.c
index 2a6f9124aee0f9a66e3c6a004d8456442d7a067b..da5b7bbe8ba1ffa84ddae9ab8e2fc5325c7a69ad 100644 (file)
--- a/src/write_redis.c
+++ b/src/write_redis.c
char *value_ptr;
int status;
redisReply *rr;
- int i;
status = FORMAT_VL (ident, sizeof (ident), vl);
if (status != 0)
memset (value, 0, sizeof (value));
value_size = sizeof (value);
value_ptr = &value[0];
-
-#define APPEND(...) do { \
- status = snprintf (value_ptr, value_size, __VA_ARGS__); \
- if (((size_t) status) > value_size) \
- { \
- value_ptr += value_size; \
- value_size = 0; \
- } \
- else \
- { \
- value_ptr += status; \
- value_size -= status; \
- } \
-} while (0)
-
- APPEND ("%s:", time);
-
- for (i = 0; i < ds->ds_num; i++)
- {
- if (ds->ds[i].type == DS_TYPE_COUNTER)
- APPEND ("%llu", vl->values[i].counter);
- else if (ds->ds[i].type == DS_TYPE_GAUGE)
- APPEND (GAUGE_FORMAT, vl->values[i].gauge);
- else if (ds->ds[i].type == DS_TYPE_DERIVE)
- APPEND ("%"PRIi64, vl->values[i].derive);
- else if (ds->ds[i].type == DS_TYPE_ABSOLUTE)
- APPEND ("%"PRIu64, vl->values[i].absolute);
- else
- assert (23 == 42);
- }
-
-#undef APPEND
-
status = format_values (value_ptr, value_size, ds, vl, /* store rates = */ 0);
pthread_mutex_lock (&node->lock);
if (status != 0)