The branch, master has been updated via a12c330 s4-server: cleanup allocation of process models via 6614f84 s4-ldb: fixed sorting of module names from 598b565 s4:objectguid LDB module - remove "objectguid_find_attribute"
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit a12c3305b328d653a19cb17fcf1d47e3ab9b0898 Author: Andrew Tridgell <tri...@samba.org> Date: Wed Nov 3 20:57:38 2010 +1100 s4-server: cleanup allocation of process models Autobuild-User: Andrew Tridgell <tri...@samba.org> Autobuild-Date: Wed Nov 3 10:40:52 UTC 2010 on sn-devel-104 commit 6614f847e06551b08f59106352df02c5d13ff23a Author: Andrew Tridgell <tri...@samba.org> Date: Wed Nov 3 20:37:08 2010 +1100 s4-ldb: fixed sorting of module names this should also fix a valgrind error on freebsd thanks to Matthieu for spotting this ----------------------------------------------------------------------- Summary of changes: source4/lib/ldb/common/ldb_modules.c | 7 ++++++- source4/smbd/process_model.c | 14 +++++--------- source4/smbd/process_model.h | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 1218907..1457298 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -906,6 +906,11 @@ static int ldb_modules_load_one(const char *path, const char *version) return ret; } +static int qsort_string(const char **s1, const char **s2) +{ + return strcmp(*s1, *s2); +} + /* load all modules from the given ldb modules directory. This is run once @@ -961,7 +966,7 @@ static int ldb_modules_load_dir(const char *modules_dir, const char *version) closedir(dir); /* sort the directory, so we get consistent load ordering */ - qsort(modlist, num_modules, sizeof(modlist[0]), QSORT_CAST strcmp); + TYPESAFE_QSORT(modlist, num_modules, qsort_string); for (i=0; i<num_modules; i++) { int ret = ldb_modules_load_one(modlist[i], version); diff --git a/source4/smbd/process_model.c b/source4/smbd/process_model.c index 7b18f58..af12a7b 100644 --- a/source4/smbd/process_model.c +++ b/source4/smbd/process_model.c @@ -24,7 +24,7 @@ /* the list of currently registered process models */ static struct process_model { - struct model_ops *ops; + const struct model_ops *ops; bool initialised; } *models = NULL; static int num_models; @@ -74,10 +74,8 @@ _PUBLIC_ const struct model_ops *process_model_startup(const char *model) The 'name' can be later used by other backends to find the operations structure for this backend. */ -_PUBLIC_ NTSTATUS register_process_model(const void *_ops) +_PUBLIC_ NTSTATUS register_process_model(const struct model_ops *ops) { - const struct model_ops *ops = _ops; - if (process_model_byname(ops->name) != NULL) { /* its already registered! */ DEBUG(0,("PROCESS_MODEL '%s' already registered\n", @@ -85,19 +83,17 @@ _PUBLIC_ NTSTATUS register_process_model(const void *_ops) return NT_STATUS_OBJECT_NAME_COLLISION; } - models = realloc_p(models, struct process_model, num_models+1); + models = talloc_realloc(NULL, models, struct process_model, num_models+1); if (!models) { smb_panic("out of memory in register_process_model"); } - models[num_models].ops = smb_xmemdup(ops, sizeof(*ops)); - models[num_models].ops->name = smb_xstrdup(ops->name); + models[num_models].ops = ops; models[num_models].initialised = false; num_models++; - DEBUG(3,("PROCESS_MODEL '%s' registered\n", - ops->name)); + DEBUG(3,("PROCESS_MODEL '%s' registered\n", ops->name)); return NT_STATUS_OK; } diff --git a/source4/smbd/process_model.h b/source4/smbd/process_model.h index b579031..4399d36 100644 --- a/source4/smbd/process_model.h +++ b/source4/smbd/process_model.h @@ -80,7 +80,7 @@ struct process_model_critical_sizes { extern const struct model_ops single_ops; const struct model_ops *process_model_startup(const char *model); -NTSTATUS register_process_model(const void *_ops); +NTSTATUS register_process_model(const struct model_ops *ops); NTSTATUS process_model_init(struct loadparm_context *lp_ctx); #endif /* __PROCESS_MODEL_H__ */ -- Samba Shared Repository