Registry client library: Remove two elementar conversion functions
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Fri, 19 Sep 2008 12:35:35 +0000 (14:35 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 21 Sep 2008 21:18:01 +0000 (23:18 +0200)
source4/lib/registry/rpc.c

index b5918dc4db8151f2fa5499ce8ef91d18f8231b33..caf53186935d1e24f82495b298554dfa821b4d75 100644 (file)
@@ -66,17 +66,6 @@ static void chars_to_winreg_String(TALLOC_CTX *mem_ctx, struct winreg_String
        winregStr->name_size = winregStr->name_len;
 }
 
-/*
- * Converts a WINREG string into a SAMBA string
- */
-static void winreg_String_to_chars(TALLOC_CTX *mem_ctx, const char **str,
-       struct winreg_String *winregStr)
-{
-       *str = NULL;
-       if (winregStr->name != NULL)
-               *str = talloc_strdup(mem_ctx, winregStr->name);
-}
-
 /*
  * Converts a SAMBA string into a WINREG string buffer
  */
@@ -92,17 +81,6 @@ static void chars_to_winreg_StringBuf(TALLOC_CTX *mem_ctx, struct winreg_StringB
        winregStrBuf->size = size;
 }
 
-/*
- * Converts a WINREG string buffer into a SAMBA string
- */
-static void winreg_StringBuf_to_chars(TALLOC_CTX *mem_ctx, const char **str,
-       struct winreg_StringBuf *winregStrBuf)
-{
-       *str = NULL;
-       if (winregStrBuf->name != NULL)
-               *str = talloc_strdup(mem_ctx, winregStrBuf->name);
-}
-
 #define openhive(u) static WERROR open_ ## u(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *hnd) \
 { \
        struct winreg_Open ## u r; \
@@ -280,7 +258,7 @@ static WERROR rpc_get_value_by_index(TALLOC_CTX *mem_ctx,
                return ntstatus_to_werror(status);
        }
 
-       winreg_StringBuf_to_chars(mem_ctx, value_name, r.out.name);
+       *value_name = talloc_strdup(mem_ctx, r.out.name->name);
        *type = *(r.out.type);
        *data = data_blob_talloc(mem_ctx, r.out.value, *r.out.length);
 
@@ -368,9 +346,9 @@ static WERROR rpc_get_subkey_by_index(TALLOC_CTX *mem_ctx,
        }
 
        if (name != NULL)
-               winreg_StringBuf_to_chars(mem_ctx, name, r.out.name);
+               *name = talloc_strdup(mem_ctx, r.out.name->name);
        if (keyclass != NULL)
-               winreg_StringBuf_to_chars(mem_ctx, keyclass, r.out.keyclass);
+               *keyclass = talloc_strdup(mem_ctx, r.out.keyclass->name);
        if (last_changed_time != NULL)
                *last_changed_time = *(r.out.last_changed_time);
 
@@ -443,7 +421,7 @@ static WERROR rpc_query_key(TALLOC_CTX *mem_ctx, const struct registry_key *k)
                return ntstatus_to_werror(status);
        }
 
-       winreg_String_to_chars(mem_ctx, &mykeydata->classname, r.out.classname);
+       mykeydata->classname = talloc_strdup(mem_ctx, r.out.classname->name);
 
        return r.out.result;
 }