summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-07-15 12:47:12 +0200
committerMichael Adam <obnox@samba.org>2009-07-15 14:01:57 +0200
commit92df5e4a0243bde6fbc5261bf6758090c4c35eee (patch)
tree31aa5267f1e7c1b2cfa11e813e2ce9ce861e6dea /source3/registry
parentdc0bcfa188cb24c5a34f592ece946682d5fb8afe (diff)
downloadsamba-92df5e4a0243bde6fbc5261bf6758090c4c35eee.tar.gz
samba-92df5e4a0243bde6fbc5261bf6758090c4c35eee.tar.bz2
samba-92df5e4a0243bde6fbc5261bf6758090c4c35eee.zip
s3:registry: add function regsubkey_ctr_reinit()
This reinitializes an already allocated regsubkey_ctr structure, emptying out the subkey array and hash table. Michael
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_objects.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c
index a592c76e1d..0c0455aada 100644
--- a/source3/registry/reg_objects.c
+++ b/source3/registry/reg_objects.c
@@ -63,6 +63,29 @@ WERROR regsubkey_ctr_init(TALLOC_CTX *mem_ctx, struct regsubkey_ctr **ctr)
return WERR_OK;
}
+/**
+ * re-initialize the list of subkeys (to the emtpy list)
+ * in an already allocated regsubkey_ctr
+ */
+
+WERROR regsubkey_ctr_reinit(struct regsubkey_ctr *ctr)
+{
+ if (ctr == NULL) {
+ return WERR_INVALID_PARAM;
+ }
+
+ talloc_free(ctr->subkeys_hash);
+ ctr->subkeys_hash = db_open_rbt(ctr);
+ W_ERROR_HAVE_NO_MEMORY(ctr->subkeys_hash);
+
+ TALLOC_FREE(ctr->subkeys);
+
+ ctr->num_subkeys = 0;
+ ctr->seqnum = 0;
+
+ return WERR_OK;
+}
+
WERROR regsubkey_ctr_set_seqnum(struct regsubkey_ctr *ctr, int seqnum)
{
if (ctr == NULL) {