s3:registry: add function registry_value_cmp()
authorGregor Beck <gbeck@sernet.de>
Mon, 7 May 2012 13:43:27 +0000 (15:43 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 26 Jun 2012 17:57:19 +0000 (19:57 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
source3/registry/reg_api_util.c
source3/registry/reg_api_util.h

index 42aaa00c61b1052cec761e2257fd8ec5249a40d8..e86e3e3fc32476a696d5104a09f13ab6b930118a 100644 (file)
@@ -237,3 +237,11 @@ struct registry_value *registry_value_multi_sz(TALLOC_CTX *mem_ctx, const char *
 
        return ret;
 }
+
+int registry_value_cmp(const struct registry_value* v1, const struct registry_value* v2)
+{
+       if (v1->type == v2->type) {
+               return data_blob_cmp(&v1->data, &v2->data);
+       }
+       return v1->type - v2->type;
+}
index 7009794bebaf078623c260a8e1c2c62ad9f75f98..b5ce0fdbe47bc7c75f47aa1ec30d406912b5970c 100644 (file)
@@ -44,4 +44,6 @@ struct registry_value *registry_value_dw(TALLOC_CTX *mem_ctx, uint32_t dw);
 struct registry_value *registry_value_sz(TALLOC_CTX *mem_ctx, const char *str);
 struct registry_value *registry_value_multi_sz(TALLOC_CTX *mem_ctx, const char **str);
 
+int registry_value_cmp(const struct registry_value *v1, const struct registry_value *v2);
+
 #endif /* _REG_API_UTIL_H */