summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Eitzenberger <heitzenberger@astaro.com>2009-10-13 10:27:04 +0200
committerHarald Welte <laforge@gnumonks.org>2010-10-21 19:15:38 +0200
commit686561123987cf6e0759f07715eb38be5ba4d6c5 (patch)
tree62047047633c3d11babf04276f17b7cabd6d366b
parentc748b369e1446ed5745499b3db7b05537c0375e7 (diff)
db: micro-optimize row writing
It is specifically not needed to write the whole ulogd_value, just set its type to ULOGD_RET_NONE. Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
-rw-r--r--src/db.c6
-rw-r--r--src/plugin.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/db.c b/src/db.c
index 6837850..a5b76ed 100644
--- a/src/db.c
+++ b/src/db.c
@@ -691,10 +691,10 @@ ulogd_db_interp(struct ulogd_pluginstance *pi, unsigned *flags)
for (i = 0; i < di->num_cols; i++) {
key = di->map[i].key;
- if (!key)
- memset(&row->value[i], 0, sizeof(struct ulogd_value));
- else
+ if (key)
memcpy(&row->value[i], &key->val, sizeof(struct ulogd_value));
+ else
+ row->value[i].type = ULOGD_RET_NONE;
}
if (db_row_add(pi, row) < 0)
diff --git a/src/plugin.c b/src/plugin.c
index e88f9c8..8359c1b 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -870,8 +870,12 @@ ulogd_value_to_ascii(const struct ulogd_value *val, char *buf, size_t len)
nchars = strlen(buf);
break;
- default:
+ case ULOGD_RET_NONE:
+ case ULOGD_RET_RAW: /* how to print? */
break;
+
+ default:
+ BUG();
}
return nchars;