lib/param: remove duplicated copy service in lpcfg_add_a_service
authorGarming Sam <garming@catalyst.net.nz>
Tue, 18 Feb 2014 00:26:22 +0000 (13:26 +1300)
committerJeremy Allison <jra@samba.org>
Wed, 7 May 2014 17:49:15 +0000 (19:49 +0200)
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/param/loadparm.c

index 8a6e300a8ac587321113c037ddfa5bd680de4785..e7ebdc3bb01f6b0b10ae2a32e2be84f4e3a9c622 100644 (file)
@@ -557,18 +557,6 @@ bool lpcfg_parm_bool(struct loadparm_context *lp_ctx,
 }
 
 
-/**
- * Initialise a service to the defaults.
- */
-
-static struct loadparm_service *init_service(TALLOC_CTX *mem_ctx, struct loadparm_service *sDefault)
-{
-       struct loadparm_service *pservice =
-               talloc_zero(mem_ctx, struct loadparm_service);
-       copy_service(pservice, sDefault, NULL);
-       return pservice;
-}
-
 /**
  * Set a string value, deallocating any existing space, and allocing the space
  * for the string
@@ -621,7 +609,6 @@ struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
                                           const char *name)
 {
        int i;
-       struct loadparm_service tservice;
        int num_to_alloc = lp_ctx->iNumServices + 1;
        struct parmlist_entry *data, *pdata;
 
@@ -629,8 +616,6 @@ struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
                pservice = lp_ctx->sDefault;
        }
 
-       tservice = *pservice;
-
        /* it might already exist */
        if (name) {
                struct loadparm_service *service = getservicebyname(lp_ctx,
@@ -671,12 +656,12 @@ struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
                lp_ctx->iNumServices++;
        }
 
-       lp_ctx->services[i] = init_service(lp_ctx->services, lp_ctx->sDefault);
+       lp_ctx->services[i] = talloc_zero(lp_ctx->services, struct loadparm_service);
        if (lp_ctx->services[i] == NULL) {
                DEBUG(0,("lpcfg_add_service: out of memory!\n"));
                return NULL;
        }
-       copy_service(lp_ctx->services[i], &tservice, NULL);
+       copy_service(lp_ctx->services[i], pservice, NULL);
        if (name != NULL)
                lpcfg_string_set(lp_ctx->services[i], &lp_ctx->services[i]->szService, name);
        return lp_ctx->services[i];