loadparm: refactor processing of service out of process_registry_globals()
authorMichael Adam <obnox@samba.org>
Thu, 15 May 2008 00:08:14 +0000 (02:08 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 10 Jul 2008 21:34:03 +0000 (23:34 +0200)
into new function process_registry_service().

Michael
(cherry picked from commit 2986e5174e69527465ae7ef8e108110416752b56)

source/param/loadparm.c

index 55b11f062a501f41a03d2acfe4871f01237ab481..df8c4e9212275b50405a7cd06353e6fc72b36b32 100644 (file)
@@ -6519,6 +6519,26 @@ static struct smbconf_ctx *lp_smbconf_ctx(void)
        return conf_ctx;
 }
 
+static bool process_registry_service(struct smbconf_service *service)
+{
+       uint32_t count;
+       bool ret;
+
+       if (service == NULL) {
+               return false;
+       }
+
+       for (count = 0; count < service->num_params; count++) {
+               ret = do_parameter(service->param_names[count],
+                                  service->param_values[count],
+                                  NULL);
+               if (ret != true) {
+                       return false;
+               }
+       }
+       return true;
+}
+
 /*
  * process_registry_globals
  */
@@ -6526,7 +6546,6 @@ static bool process_registry_globals(void)
 {
        WERROR werr;
        struct smbconf_service *service = NULL;
-       uint32_t count;
        TALLOC_CTX *mem_ctx = talloc_stackframe();
        struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
        bool ret = false;
@@ -6547,13 +6566,9 @@ static bool process_registry_globals(void)
                goto done;
        }
 
-       for (count = 0; count < service->num_params; count++) {
-               ret = do_parameter(service->param_names[count],
-                                  service->param_values[count],
-                                  NULL);
-               if (ret != true) {
-                       goto done;
-               }
+       ret = process_registry_service(service);
+       if (!ret) {
+               goto done;
        }
 
        ret = do_parameter("registry shares", "yes", NULL);