From: Sebastian Harl Date: Fri, 4 Jul 2014 18:57:41 +0000 (+0200) Subject: store: Don't update unchanged attribute values. X-Git-Tag: sysdb-0.3.0~84 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=222a6b91614c77fbfddf561c35985f7a4a3457be;p=sysdb.git store: Don't update unchanged attribute values. When handling dynamically allocated data, this would generate unnecessary memory churn. --- 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;