[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Nov 26 17:42:05 MST 2014


The branch, master has been updated
       via  733422c param: Simplify get_parametric_helper()
       via  46f27a8 registry3: Fix a typo
      from  f833052 param: remove unused get_share_params()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 733422c611a72bcf8c53b423a466277c4b783941
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 26 21:35:27 2014 +0100

    param: Simplify get_parametric_helper()
    
    With variable sized arrays we don't need talloc_asprintf here
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Nov 27 01:41:09 CET 2014 on sn-devel-104

commit 46f27a8f7824e08bf8e212a192e92b083bf59227
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 26 21:34:44 2014 +0100

    registry3: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/param/loadparm.c             | 19 ++++---------------
 source3/registry/reg_init_full.c |  2 +-
 2 files changed, 5 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 30b1155..1a60b99 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -241,16 +241,12 @@ struct parmlist_entry *get_parametric_helper(struct loadparm_service *service,
 					     const char *type, const char *option,
 					     struct parmlist_entry *global_opts)
 {
-	char* param_key;
+	size_t type_len = strlen(type);
+	size_t option_len = strlen(option);
+	char param_key[type_len + option_len + 2];
 	struct parmlist_entry *data = NULL;
-	TALLOC_CTX *mem_ctx = talloc_stackframe();
 
-	param_key = talloc_asprintf(mem_ctx, "%s:%s", type, option);
-	if (param_key == NULL) {
-		DEBUG(0,("asprintf failed!\n"));
-		TALLOC_FREE(mem_ctx);
-		return NULL;
-	}
+	snprintf(param_key, sizeof(param_key), "%s:%s", type, option);
 
 	/*
 	 * Try to fetch the option from the data.
@@ -259,7 +255,6 @@ struct parmlist_entry *get_parametric_helper(struct loadparm_service *service,
 		data = service->param_opt;
 		while (data != NULL) {
 			if (strwicmp(data->key, param_key) == 0) {
-				TALLOC_FREE(mem_ctx);
 				return data;
 			}
 			data = data->next;
@@ -272,18 +267,12 @@ struct parmlist_entry *get_parametric_helper(struct loadparm_service *service,
 	data = global_opts;
 	while (data != NULL) {
 		if (strwicmp(data->key, param_key) == 0) {
-			TALLOC_FREE(mem_ctx);
 			return data;
 		}
 		data = data->next;
 	}
 
-
-	TALLOC_FREE(mem_ctx);
-
 	return NULL;
-
-
 }
 
 const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx,
diff --git a/source3/registry/reg_init_full.c b/source3/registry/reg_init_full.c
index b222d13..e47b3f6 100644
--- a/source3/registry/reg_init_full.c
+++ b/source3/registry/reg_init_full.c
@@ -69,7 +69,7 @@ struct registry_hook reg_hooks[] = {
 
 /***********************************************************************
  Open the registry database and initialize the registry_hook cache
- with all available backens.
+ with all available backends.
  ***********************************************************************/
 
 WERROR registry_init_full(void)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list