s3: Make alloc_sub_basic() static
authorVolker Lendecke <vl@samba.org>
Sat, 21 Nov 2009 19:23:35 +0000 (20:23 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 21 Nov 2009 19:54:10 +0000 (20:54 +0100)
source3/include/proto.h
source3/lib/substitute.c
source3/param/loadparm.c

index 8cf4769..6a5b3ec 100644 (file)
@@ -794,8 +794,6 @@ void standard_sub_basic(const char *smb_name, const char *domain_name,
                        char *str, size_t len);
 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
                       const char *domain_name, const char *str);
-char *alloc_sub_basic(const char *smb_name, const char *domain_name,
-                     const char *str);
 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
                        const char *input_string,
                        const char *username,
index 55acdd9..64ef95a 100644 (file)
@@ -21,6 +21,9 @@
 
 #include "includes.h"
 
+static char *alloc_sub_basic(const char *smb_name, const char *domain_name,
+                            const char *str);
+
 userdom_struct current_user_info;
 fstring remote_proto="UNKNOWN";
 
@@ -544,8 +547,8 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
 /****************************************************************************
 ****************************************************************************/
 
-char *alloc_sub_basic(const char *smb_name, const char *domain_name,
-                     const char *str)
+static char *alloc_sub_basic(const char *smb_name, const char *domain_name,
+                            const char *str)
 {
        char *b, *p, *s, *r, *a_string;
        fstring pidstr, vnnstr;
index 17a4e2d..b7eb80e 100644 (file)
@@ -7074,7 +7074,6 @@ bool lp_file_list_changed(void)
        DEBUG(6, ("lp_file_list_changed()\n"));
 
        while (f) {
-               char *n2 = NULL;
                time_t mod_time;
 
                if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
@@ -7090,9 +7089,11 @@ bool lp_file_list_changed(void)
                                return true;
                        }
                } else {
-                       n2 = alloc_sub_basic(get_current_username(),
-                                           current_user_info.domain,
-                                           f->name);
+                       char *n2 = NULL;
+                       n2 = talloc_sub_basic(talloc_tos(),
+                                             get_current_username(),
+                                             current_user_info.domain,
+                                             f->name);
                        if (!n2) {
                                return false;
                        }
@@ -7116,7 +7117,7 @@ bool lp_file_list_changed(void)
                                                     above. */
                                return true;
                        }
-                       SAFE_FREE(n2);
+                       TALLOC_FREE(n2);
                }
                f = f->next;
        }
@@ -7133,12 +7134,12 @@ bool lp_file_list_changed(void)
 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
 {
        bool ret;
-       char *netbios_name = alloc_sub_basic(get_current_username(),
-                                       current_user_info.domain,
-                                       pszParmValue);
+       char *netbios_name = talloc_sub_basic(
+               talloc_tos(), get_current_username(), current_user_info.domain,
+               pszParmValue);
 
        ret = set_global_myname(netbios_name);
-       SAFE_FREE(netbios_name);
+       TALLOC_FREE(netbios_name);
        string_set(&Globals.szNetbiosName,global_myname());
 
        DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
@@ -7217,9 +7218,9 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr)
                }
        }
 
-       fname = alloc_sub_basic(get_current_username(),
-                               current_user_info.domain,
-                               pszParmValue);
+       fname = talloc_sub_basic(talloc_tos(), get_current_username(),
+                                current_user_info.domain,
+                                pszParmValue);
 
        add_to_file_list(pszParmValue, fname);
 
@@ -7230,12 +7231,12 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr)
                include_depth++;
                ret = pm_process(fname, do_section, do_parameter, NULL);
                include_depth--;
-               SAFE_FREE(fname);
+               TALLOC_FREE(fname);
                return ret;
        }
 
        DEBUG(2, ("Can't find include file %s\n", fname));
-       SAFE_FREE(fname);
+       TALLOC_FREE(fname);
        return true;
 }
 
@@ -9117,7 +9118,7 @@ bool lp_load_ex(const char *pszFname,
        iServiceIndex = -1;
 
        if (lp_config_backend_is_file()) {
-               n2 = alloc_sub_basic(get_current_username(),
+               n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
                                        current_user_info.domain,
                                        pszFname);
                if (!n2) {
@@ -9127,7 +9128,7 @@ bool lp_load_ex(const char *pszFname,
                add_to_file_list(pszFname, n2);
 
                bRetval = pm_process(n2, do_section, do_parameter, NULL);
-               SAFE_FREE(n2);
+               TALLOC_FREE(n2);
 
                /* finish up the last section */
                DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));