summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cb0bc26)
raw | patch | inline | side by side (parent: cb0bc26)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 11 Feb 2014 08:25:52 +0000 (09:25 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 11 Feb 2014 08:25:52 +0000 (09:25 +0100) |
src/core/store.c | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index 7e2602730d774cf83454775e79ff87f283b82677..753b9815b0bd4b23be3bee71cfcfacb651060f28 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
time_str[sizeof(time_str) - 1] = '\0';
sdb_strbuf_append(buf, "{\"name\": \"%s\", ", SDB_OBJ(sobj)->name);
- if (type == SDB_ATTRIBUTE)
- /* XXX: this needs to be type-dependent */
- sdb_strbuf_append(buf, "\"value\": \"%s\", ",
- SDB_ATTR(sobj)->value.data.string);
- sdb_strbuf_append(buf, "\"last_update\": \"%s\"}", time_str);
+ if (type == SDB_ATTRIBUTE) {
+ sdb_strbuf_append(buf, "\"value\": ");
+ sdb_data_format(&SDB_ATTR(sobj)->value, buf);
+ sdb_strbuf_append(buf, ", \"last_update\": \"%s\"}", time_str);
+ }
+ else
+ sdb_strbuf_append(buf, "\"last_update\": \"%s\"}", time_str);
if (sdb_llist_iter_has_next(iter))
sdb_strbuf_append(buf, ",");