From 222a6b91614c77fbfddf561c35985f7a4a3457be Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 4 Jul 2014 20:57:41 +0200 Subject: [PATCH] store: Don't update unchanged attribute values. When handling dynamically allocated data, this would generate unnecessary memory churn. --- src/core/store.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/store.c b/src/core/store.c index 7de75b1..1c04a77 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -327,6 +327,10 @@ store_attr(sdb_llist_t *attributes, const char *key, const sdb_data_t *value, if (status) return status; + /* don't update unchanged values */ + if (! sdb_data_cmp(&ATTR(attr)->value, value)) + return status; + assert(attr); if (sdb_data_copy(&ATTR(attr)->value, value)) return -1; -- 2.30.2