Author: obnox
Date: 2007-09-07 15:45:39 +0000 (Fri, 07 Sep 2007)
New Revision: 25002

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25002

Log:
Refactor out code duplication created by the previous
unification of r24998.

Michael


Modified:
   branches/SAMBA_3_2/source/registry/reg_smbconf.c
   branches/SAMBA_3_2_0/source/registry/reg_smbconf.c


Changeset:
Modified: branches/SAMBA_3_2/source/registry/reg_smbconf.c
===================================================================
--- branches/SAMBA_3_2/source/registry/reg_smbconf.c    2007-09-07 15:35:18 UTC 
(rev 25001)
+++ branches/SAMBA_3_2/source/registry/reg_smbconf.c    2007-09-07 15:45:39 UTC 
(rev 25002)
@@ -168,7 +168,7 @@
                        DEBUG(10, ("adding canonicalized parameter to "
                                   "container.\n"));
 
-                       theval = regval_compose(mem_ctx, canon_valname,
+                       theval = regval_compose(val, canon_valname,
                                                value->type,
                                                (char *)value_data.data,
                                                value_data.length);
@@ -178,15 +178,6 @@
                                TALLOC_FREE(mem_ctx);
                                return False;
                        }
-                       res = regval_ctr_copyvalue(new_val_ctr, theval);
-                       if (res == 0) {
-                               DEBUG(10, ("error calling regval_ctr_addvalue. "
-                                     "(no memory?)\n"));
-                               TALLOC_FREE(mem_ctx);
-                               return False;
-                       }
-                       DEBUG(10, ("parameter added. container now has %d "
-                                  "values.\n", res));
 
                        TALLOC_FREE(mem_ctx);
                } else {
@@ -194,15 +185,15 @@
                                   "copying it to new container...\n",
                                   (lp_parameter_is_valid(valname)?
                                    "valid":"unknown")));
-                       res = regval_ctr_copyvalue(new_val_ctr, theval);
-                       if (res == 0) {
-                               DEBUG(10, ("error calling regval_ctr_copyvalue."
-                                          " (no memory?)\n"));
-                               return False;
-                       }
-                       DEBUG(10, ("parameter copied. container now has %d "
-                                  "values.\n", res));
                }
+               res = regval_ctr_copyvalue(new_val_ctr, theval);
+               if (res == 0) {
+                       DEBUG(10, ("error calling regval_ctr_copyvalue."
+                                  " (no memory?)\n"));
+                       return False;
+               }
+               DEBUG(10, ("parameter copied. container now has %d "
+                          "values.\n", res));
        }
        return regdb_ops.store_values(key, new_val_ctr);
 }

Modified: branches/SAMBA_3_2_0/source/registry/reg_smbconf.c
===================================================================
--- branches/SAMBA_3_2_0/source/registry/reg_smbconf.c  2007-09-07 15:35:18 UTC 
(rev 25001)
+++ branches/SAMBA_3_2_0/source/registry/reg_smbconf.c  2007-09-07 15:45:39 UTC 
(rev 25002)
@@ -168,7 +168,7 @@
                        DEBUG(10, ("adding canonicalized parameter to "
                                   "container.\n"));
 
-                       theval = regval_compose(mem_ctx, canon_valname,
+                       theval = regval_compose(val, canon_valname,
                                                value->type,
                                                (char *)value_data.data,
                                                value_data.length);
@@ -178,15 +178,6 @@
                                TALLOC_FREE(mem_ctx);
                                return False;
                        }
-                       res = regval_ctr_copyvalue(new_val_ctr, theval);
-                       if (res == 0) {
-                               DEBUG(10, ("error calling regval_ctr_addvalue. "
-                                     "(no memory?)\n"));
-                               TALLOC_FREE(mem_ctx);
-                               return False;
-                       }
-                       DEBUG(10, ("parameter added. container now has %d "
-                                  "values.\n", res));
 
                        TALLOC_FREE(mem_ctx);
                } else {
@@ -194,15 +185,15 @@
                                   "copying it to new container...\n",
                                   (lp_parameter_is_valid(valname)?
                                    "valid":"unknown")));
-                       res = regval_ctr_copyvalue(new_val_ctr, theval);
-                       if (res == 0) {
-                               DEBUG(10, ("error calling regval_ctr_copyvalue."
-                                          " (no memory?)\n"));
-                               return False;
-                       }
-                       DEBUG(10, ("parameter copied. container now has %d "
-                                  "values.\n", res));
                }
+               res = regval_ctr_copyvalue(new_val_ctr, theval);
+               if (res == 0) {
+                       DEBUG(10, ("error calling regval_ctr_copyvalue."
+                                  " (no memory?)\n"));
+                       return False;
+               }
+               DEBUG(10, ("parameter copied. container now has %d "
+                          "values.\n", res));
        }
        return regdb_ops.store_values(key, new_val_ctr);
 }

Reply via email to