source3/loadparm.c: Move string_set/string_free inside.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 23 Jul 2012 05:21:39 +0000 (14:51 +0930)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 7 Aug 2012 13:20:05 +0000 (23:20 +1000)
The only user, so make them static inside loadparm.c

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source3/Makefile.in
source3/include/proto.h
source3/lib/string_init.c [deleted file]
source3/param/loadparm.c
source3/wscript_build

index ff0f1f4f407a658017efb2a85301b4e090fd2672..e42c1b5684b26a075c2998b2dfbc81e7f1dd9623 100644 (file)
@@ -466,7 +466,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) $(LIBTSOCKET_OBJ) \
          ../libds/common/flag_mapping.o \
          lib/access.o lib/smbrun.o \
          ../lib/util/bitmap.o ../lib/util/dprintf.o $(UTIL_REG_OBJ) \
-         lib/wins_srv.o lib/string_init.o \
+         lib/wins_srv.o \
          lib/util_str.o ../lib/util/util_str_common.o \
          ../lib/util/util_str.o \
          ../lib/util/base64.o lib/util_sid.o \
index 101d62d3a3e29a8bfdc7c94dbdf23b40b431cdf9..ebb76efface26333dfd71da7ec6d147b1cb02e3b 100644 (file)
@@ -671,8 +671,6 @@ bool strhasupper(const char *s);
 bool strhaslower(const char *s);
 char *StrnCpy(char *dest,const char *src,size_t n);
 bool in_list(const char *s, const char *list, bool casesensitive);
-void string_free(char **s);
-bool string_set(char **dest,const char *src);
 void fstring_sub(char *s,const char *pattern,const char *insert);
 char *realloc_string_sub2(char *string,
                        const char *pattern,
diff --git a/source3/lib/string_init.c b/source3/lib/string_init.c
deleted file mode 100644 (file)
index 40a6ef0..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-   Unix SMB/CIFS implementation.
-   Samba utility functions
-
-   Copyright (C) Andrew Tridgell 1992-2001
-   Copyright (C) Simo Sorce      2001-2002
-   Copyright (C) Martin Pool     2003
-   Copyright (C) James Peach    2006
-   Copyright (C) Jeremy Allison  1992-2007
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-
-/* this is used to prevent lots of mallocs of size 1 */
-static const char null_string[] = "";
-
-/**
- Set a string value, allocing the space for the string
-**/
-
-static bool string_init(char **dest,const char *src)
-{
-       size_t l;
-
-       if (!src)
-               src = "";
-
-       l = strlen(src);
-
-       if (l == 0) {
-               *dest = discard_const_p(char, null_string);
-       } else {
-               (*dest) = SMB_STRDUP(src);
-               if ((*dest) == NULL) {
-                       DEBUG(0,("Out of memory in string_init\n"));
-                       return false;
-               }
-       }
-       return(true);
-}
-
-/**
- Free a string value.
-**/
-
-void string_free(char **s)
-{
-       if (!s || !(*s))
-               return;
-       if (*s == null_string)
-               *s = NULL;
-       SAFE_FREE(*s);
-}
-
-/**
- Set a string value, deallocating any existing space, and allocing the space
- for the string
-**/
-
-bool string_set(char **dest,const char *src)
-{
-       string_free(dest);
-       return(string_init(dest,src));
-}
index a4d5bfc55181e7cc5e75bf65d00f81ceceaa241a..9c49eb094b4a815ed70609f3f518d0a02ceea0bc 100644 (file)
@@ -326,6 +326,58 @@ static void free_param_opts(struct parmlist_entry **popts);
 
 #include "lib/param/param_table.c"
 
+/* this is used to prevent lots of mallocs of size 1 */
+static const char null_string[] = "";
+
+/**
+ Set a string value, allocing the space for the string
+**/
+
+static bool string_init(char **dest,const char *src)
+{
+       size_t l;
+
+       if (!src)
+               src = "";
+
+       l = strlen(src);
+
+       if (l == 0) {
+               *dest = discard_const_p(char, null_string);
+       } else {
+               (*dest) = SMB_STRDUP(src);
+               if ((*dest) == NULL) {
+                       DEBUG(0,("Out of memory in string_init\n"));
+                       return false;
+               }
+       }
+       return(true);
+}
+
+/**
+ Free a string value.
+**/
+
+static void string_free(char **s)
+{
+       if (!s || !(*s))
+               return;
+       if (*s == null_string)
+               *s = NULL;
+       SAFE_FREE(*s);
+}
+
+/**
+ Set a string value, deallocating any existing space, and allocing the space
+ for the string
+**/
+
+static bool string_set(char **dest,const char *src)
+{
+       string_free(dest);
+       return(string_init(dest,src));
+}
+
 /***************************************************************************
  Initialise the sDefault parameter structure for the printer values.
 ***************************************************************************/
index 40afdd759a8738eefa578964a807ce48267f1784..9125667029547e8261daae016e1dd580763056b1 100755 (executable)
@@ -1058,7 +1058,7 @@ bld.SAMBA3_SUBSYSTEM('tdb-wrap3',
                     vars=locals())
 
 bld.SAMBA3_LIBRARY('samba3-util',
-                   source='''lib/util_sec.c lib/util_str.c lib/adt_tree.c lib/util_malloc.c lib/memcache.c lib/string_init.c lib/namearray.c lib/file_id.c''',
+                   source='''lib/util_sec.c lib/util_str.c lib/adt_tree.c lib/util_malloc.c lib/memcache.c lib/namearray.c lib/file_id.c''',
                    deps='samba-util charset',
                    private_library=True)