[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-unstable-385-gf1e401e
Jeremy Allison
jra at samba.org
Wed Nov 28 03:13:23 GMT 2007
The branch, v3-2-test has been updated
via f1e401ef5c89ecf12921b7adb228da438521a693 (commit)
from b5a2a1e3f82a0d319fc9a1d76f5166150680f4d4 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit f1e401ef5c89ecf12921b7adb228da438521a693
Author: Jeremy Allison <jra at samba.org>
Date: Tue Nov 27 19:12:42 2007 -0800
Save one extra strdup per lp_string. Use talloc_sub_basic()
directly.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source/param/loadparm.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 80eac74..16c6c59 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -1729,7 +1729,8 @@ static void init_globals(bool first_time_only)
static char *lp_string(const char *s)
{
- char *ret, *tmpstr;
+ char *ret;
+ TALLOC_CTX *ctx = talloc_tos();
/* The follow debug is useful for tracking down memory problems
especially if you have an inner loop that is calling a lp_*()
@@ -1740,19 +1741,20 @@ static char *lp_string(const char *s)
DEBUG(10, ("lp_string(%s)\n", s));
#endif
- tmpstr = alloc_sub_basic(get_current_username(),
- current_user_info.domain, s);
- if (trim_char(tmpstr, '\"', '\"')) {
- if (strchr(tmpstr,'\"') != NULL) {
- SAFE_FREE(tmpstr);
- tmpstr = alloc_sub_basic(get_current_username(),
- current_user_info.domain, s);
+ ret = talloc_sub_basic(ctx,
+ get_current_username(),
+ current_user_info.domain,
+ s);
+ if (trim_char(ret, '\"', '\"')) {
+ if (strchr(ret,'\"') != NULL) {
+ TALLOC_FREE(ret);
+ ret = talloc_sub_basic(ctx,
+ get_current_username(),
+ current_user_info.domain,
+ s);
}
}
- ret = talloc_strdup(talloc_tos(), tmpstr);
- SAFE_FREE(tmpstr);
-
- return (ret);
+ return ret;
}
/*
--
Samba Shared Repository
More information about the samba-cvs
mailing list