From eacd3140573d1122a3785823e4003bfc6352c431 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 13 Sep 2007 22:08:59 +0000 Subject: r25138: More pstring elimination. Add a TALLOC_CTX parameter to unix_convert(). Jeremy. (This used to be commit 39c211a702e91c34c1a5a689e1b0c4530ea8a1ac) --- source3/lib/util_str.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source3/lib/util_str.c') 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) -- cgit