From e78d647ebcdd353af3c270903b88d08ab5004a28 Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Mon, 7 May 2012 15:43:27 +0200 Subject: s3:registry: add function registry_value_cmp() Signed-off-by: Michael Adam --- source3/registry/reg_api_util.c | 8 ++++++++ source3/registry/reg_api_util.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'source3/registry') diff --git a/source3/registry/reg_api_util.c b/source3/registry/reg_api_util.c index 42aaa00c61..e86e3e3fc3 100644 --- a/source3/registry/reg_api_util.c +++ b/source3/registry/reg_api_util.c @@ -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; +} diff --git a/source3/registry/reg_api_util.h b/source3/registry/reg_api_util.h index 7009794beb..b5ce0fdbe4 100644 --- a/source3/registry/reg_api_util.h +++ b/source3/registry/reg_api_util.h @@ -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 */ -- cgit