diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-09-27 17:37:53 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-09-27 17:37:53 +0200 |
commit | d9ada600cc81603300a0cfce75179c6aa1ac94cc (patch) | |
tree | 3d7dc80587be662a886aed0a643762c4574aac92 /source4/param | |
parent | 43267812e17cc7749bb9275574af5eccc74129e5 (diff) | |
download | samba-d9ada600cc81603300a0cfce75179c6aa1ac94cc.tar.gz samba-d9ada600cc81603300a0cfce75179c6aa1ac94cc.tar.bz2 samba-d9ada600cc81603300a0cfce75179c6aa1ac94cc.zip |
parmlist: Add more tests.
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/generic.c | 10 | ||||
-rw-r--r-- | source4/param/loadparm.c | 24 |
2 files changed, 16 insertions, 18 deletions
diff --git a/source4/param/generic.c b/source4/param/generic.c index 802f90764c..41d01de9d3 100644 --- a/source4/param/generic.c +++ b/source4/param/generic.c @@ -92,16 +92,14 @@ const char *param_get_string(struct param_context *ctx, const char *param, const return parmlist_get_string(section->parameters, param, NULL); } -int param_set_string(struct param_context *ctx, const char *param, const char *value, const char *section) +int param_set_string(struct param_context *ctx, const char *param, const char *value, const char *section_name) { - struct parmlist_entry *p = param_get_add(ctx, param, section); + struct param_section *section = param_get_section(ctx, section_name); - if (p == NULL) + if (section == NULL) return -1; - p->value = talloc_strdup(p, value); - - return 0; + return parmlist_set_string(section->parameters, param, value); } const char **param_get_string_list(struct param_context *ctx, const char *param, const char *separator, const char *section_name) diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 21e01b74fd..f7cd95bf4c 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -182,7 +182,7 @@ struct loadparm_global int bDisableNetbios; int bRpcBigEndian; char *szNTPSignDSocketDirectory; - struct param_opt *param_opt; + struct parmlist_entry *param_opt; }; @@ -222,7 +222,7 @@ struct loadparm_service int bMSDfsRoot; int bStrictSync; int bCIFileSystem; - struct param_opt *param_opt; + struct parmlist_entry *param_opt; char dummy[3]; /* for alignment */ }; @@ -749,7 +749,7 @@ const char *lp_get_parametric(struct loadparm_context *lp_ctx, const char *type, const char *option) { char *vfskey; - struct param_opt *data; + struct parmlist_entry *data; if (lp_ctx == NULL) return NULL; @@ -1020,7 +1020,7 @@ struct loadparm_service *lp_add_service(struct loadparm_context *lp_ctx, int i; struct loadparm_service tservice; int num_to_alloc = lp_ctx->iNumServices + 1; - struct param_opt *data, *pdata; + struct parmlist_entry *data, *pdata; tservice = *pservice; @@ -1260,7 +1260,7 @@ static void copy_service(struct loadparm_service *pserviceDest, { int i; bool bcopyall = (pcopymapDest == NULL); - struct param_opt *data, *pdata, *paramo; + struct parmlist_entry *data, *pdata, *paramo; bool not_added; for (i = 0; parm_table[i].label; i++) @@ -1328,7 +1328,7 @@ static void copy_service(struct loadparm_service *pserviceDest, pdata = pdata->next; } if (not_added) { - paramo = talloc(pserviceDest, struct param_opt); + paramo = talloc(pserviceDest, struct parmlist_entry); if (paramo == NULL) smb_panic("OOM"); paramo->key = talloc_reference(paramo, data->key); @@ -1544,7 +1544,7 @@ static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx, const char *pszParmName, const char *pszParmValue, int flags) { - struct param_opt *paramo, *data; + struct parmlist_entry *paramo, *data; char *name; TALLOC_CTX *mem_ctx; @@ -1583,7 +1583,7 @@ static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx, } } - paramo = talloc(mem_ctx, struct param_opt); + paramo = talloc(mem_ctx, struct parmlist_entry); if (!paramo) smb_panic("OOM"); paramo->key = talloc_strdup(paramo, name); @@ -2048,7 +2048,7 @@ static void dump_globals(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults) { int i; - struct param_opt *data; + struct parmlist_entry *data; fprintf(f, "# Global parameters\n[global]\n"); @@ -2078,7 +2078,7 @@ static void dump_globals(struct loadparm_context *lp_ctx, FILE *f, static void dump_a_service(struct loadparm_service * pService, struct loadparm_service *sDefault, FILE * f) { int i; - struct param_opt *data; + struct parmlist_entry *data; if (pService != sDefault) fprintf(f, "\n[%s]\n", pService->szService); @@ -2217,10 +2217,10 @@ void lp_killunused(struct loadparm_context *lp_ctx, static int lp_destructor(struct loadparm_context *lp_ctx) { - struct param_opt *data; + struct parmlist_entry *data; if (lp_ctx->globals->param_opt != NULL) { - struct param_opt *next; + struct parmlist_entry *next; for (data = lp_ctx->globals->param_opt; data; data=next) { next = data->next; if (data->priority & FLAG_CMDLINE) continue; |