From 7e297ecfa4db2c7ab720a63c7764bc0e20f8058c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 9 Sep 2007 19:34:30 +0000 Subject: r25047: Fix more warnings. (This used to be commit 69de86d2d2e49439760fbc61901eb87fb7fc5d55) --- source4/param/loadparm.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'source4/param/loadparm.c') diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 2dbf7cd60a..f5c0ba51eb 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -1030,6 +1030,28 @@ static struct loadparm_service *init_service(TALLOC_CTX *mem_ctx) return pservice; } +/** + Set a string value, deallocating any existing space, and allocing the space + for the string +**/ +static bool string_set(TALLOC_CTX *mem_ctx, char **dest, const char *src) +{ + talloc_free(*dest); + + if (src == NULL) + src = ""; + + *dest = talloc_strdup(mem_ctx, src); + if ((*dest) == NULL) { + DEBUG(0,("Out of memory in string_init\n")); + return false; + } + + return true; +} + + + /*************************************************************************** Add a new service to the services array initialising it with the given service. @@ -2495,20 +2517,22 @@ bool lp_load(void) Return the max number of services. ***************************************************************************/ -int lp_numservices(struct loadparm_context *lp_ctx) +int lp_numservices(void) { - return lp_ctx->iNumServices; + return loadparm.iNumServices; } /*************************************************************************** Display the contents of the services array in human-readable form. ***************************************************************************/ -void lp_dump(FILE *f, bool show_defaults, int maxtoprint, - struct loadparm_context *lp_ctx) +void lp_dump(FILE *f, bool show_defaults, int maxtoprint) { + struct loadparm_context *lp_ctx; int iService; + lp_ctx = &loadparm; + if (show_defaults) defaults_saved = false; -- cgit