summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-09 19:34:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:05:49 -0500
commit7e297ecfa4db2c7ab720a63c7764bc0e20f8058c (patch)
tree6fdb0b5a3a713c5aab9669ef021456b2063919e6 /source4/param
parent43742e53c900733cf0eff085cb073d0c1c937530 (diff)
downloadsamba-7e297ecfa4db2c7ab720a63c7764bc0e20f8058c.tar.gz
samba-7e297ecfa4db2c7ab720a63c7764bc0e20f8058c.tar.bz2
samba-7e297ecfa4db2c7ab720a63c7764bc0e20f8058c.zip
r25047: Fix more warnings.
(This used to be commit 69de86d2d2e49439760fbc61901eb87fb7fc5d55)
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/loadparm.c32
-rw-r--r--source4/param/share.c7
2 files changed, 29 insertions, 10 deletions
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;
diff --git a/source4/param/share.c b/source4/param/share.c
index e7c00f5b35..abc5e2ebeb 100644
--- a/source4/param/share.c
+++ b/source4/param/share.c
@@ -116,12 +116,7 @@ NTSTATUS share_register(const struct share_ops *ops)
smb_panic("out of memory in share_register");
}
- backends[i] = malloc(sizeof(struct share_ops));
- if (!backends[i]) {
- smb_panic("out of memory in share_register");
- }
-
- backends[i] = smb_xmemdup(ops, sizeof(*ops));
+ backends[i] = (struct share_ops *)smb_xmemdup(ops, sizeof(*ops));
backends[i]->name = smb_xstrdup(ops->name);
backends[i + 1] = NULL;