summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-09-13 22:08:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:44 -0500
commiteacd3140573d1122a3785823e4003bfc6352c431 (patch)
treea1ee9d9e59da4c44e0484d895eb78a8c8e1f0de2 /source3/lib/util_str.c
parentd0de93ca762e8b59f09c2179448188c9952f68fc (diff)
downloadsamba-eacd3140573d1122a3785823e4003bfc6352c431.tar.gz
samba-eacd3140573d1122a3785823e4003bfc6352c431.tar.bz2
samba-eacd3140573d1122a3785823e4003bfc6352c431.zip
r25138: More pstring elimination. Add a TALLOC_CTX parameter
to unix_convert(). Jeremy. (This used to be commit 39c211a702e91c34c1a5a689e1b0c4530ea8a1ac)
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r--source3/lib/util_str.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 36cd716462..c2eeb12544 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -549,9 +549,14 @@ size_t str_charnum(const char *s)
size_t str_ascii_charnum(const char *s)
{
- pstring tmpbuf2;
- push_ascii(tmpbuf2, s, sizeof(tmpbuf2), STR_TERMINATE);
- return strlen(tmpbuf2);
+ size_t ret;
+ char *tmpbuf2 = NULL;
+ if (push_ascii_allocate(&tmpbuf2, s) == (size_t)-1) {
+ return 0;
+ }
+ ret = strlen(tmpbuf2);
+ SAFE_FREE(tmpbuf2);
+ return ret;
}
BOOL trim_char(char *s,char cfront,char cback)