s3-printing: use regval_ctr_addvalue_multi_sz.
authorGünther Deschner <gd@samba.org>
Wed, 30 Sep 2009 13:22:02 +0000 (15:22 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 30 Sep 2009 14:23:40 +0000 (16:23 +0200)
Guenther

source3/printing/nt_printing.c

index f09615c06c61d97e587c78409eefea5aff963528..3c7f053ff262645962b05268a620f532f1f0201e 100644 (file)
@@ -3057,26 +3057,13 @@ static void map_bool_into_ctr(struct regval_ctr *ctr, const char *val_name,
 static void map_single_multi_sz_into_ctr(struct regval_ctr *ctr, const char *val_name,
                                         const char *multi_sz)
 {
-       smb_ucs2_t *conv_strs = NULL;
-       size_t str_size;
-
-       /* a multi-sz has to have a null string terminator, i.e., the last
-          string must be followed by two nulls */
-       str_size = strlen(multi_sz) + 2;
-       conv_strs = SMB_CALLOC_ARRAY(smb_ucs2_t, str_size);
-       if (!conv_strs) {
-               return;
-       }
+       const char *a[2];
 
-       /* Change to byte units. */
-       str_size *= sizeof(smb_ucs2_t);
-       push_ucs2(NULL, conv_strs, multi_sz, str_size,
-                 STR_TERMINATE | STR_NOALIGN);
+       a[0] = multi_sz;
+       a[1] = NULL;
 
        regval_ctr_delvalue(ctr, val_name);
-       regval_ctr_addvalue(ctr, val_name, REG_MULTI_SZ,
-                           (char *) conv_strs, str_size);
-       SAFE_FREE(conv_strs);
+       regval_ctr_addvalue_multi_sz(ctr, val_name, a);
 }
 
 /****************************************************************************