summaryrefslogtreecommitdiff
path: root/source4/lib/util_str.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-08-24 01:32:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:16 -0500
commit694ac65faa13cc016f54330b656e64225aa40aab (patch)
tree854ad9d4f278ceb67916d68b2843245a1d231097 /source4/lib/util_str.c
parentaf057bdf84d91fe387e7920a6b753142e82d7682 (diff)
downloadsamba-694ac65faa13cc016f54330b656e64225aa40aab.tar.gz
samba-694ac65faa13cc016f54330b656e64225aa40aab.tar.bz2
samba-694ac65faa13cc016f54330b656e64225aa40aab.zip
r2003: got rid of next_token_nr(), which involved some horrible globals
and nasy pointer tricks. this involved fixing some of the internals of smbclient (This used to be commit 126fec6169f9412932c82e7675840476132bce87)
Diffstat (limited to 'source4/lib/util_str.c')
-rw-r--r--source4/lib/util_str.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c
index a66a363c17..fc76aed44a 100644
--- a/source4/lib/util_str.c
+++ b/source4/lib/util_str.c
@@ -67,25 +67,6 @@ BOOL next_token(const char **ptr,char *buff, const char *sep, size_t bufsize)
return(True);
}
-/**
-This is like next_token but is not re-entrant and "remembers" the first
-parameter so you can pass NULL. This is useful for user interface code
-but beware the fact that it is not re-entrant!
-**/
-
-static char *last_ptr=NULL;
-
-BOOL next_token_nr(const char **ptr, char *buff, const char *sep, size_t bufsize)
-{
- BOOL ret;
- if (!ptr)
- ptr = (const char **)&last_ptr;
-
- ret = next_token(ptr, buff, sep, bufsize);
- last_ptr = *ptr;
- return ret;
-}
-
static uint16_t tmpbuf[sizeof(pstring)];
/**
@@ -93,9 +74,9 @@ static uint16_t tmpbuf[sizeof(pstring)];
Uses last_ptr from above - bit of a hack.
**/
-char **toktocliplist(int *ctok, const char *sep)
+char **toktocliplist(const char *ptr, int *ctok, const char *sep)
{
- char *s=last_ptr;
+ char *s = ptr;
int ictok=0;
char **ret, **iret;
@@ -118,7 +99,7 @@ char **toktocliplist(int *ctok, const char *sep)
} while(*s);
*ctok=ictok;
- s=last_ptr;
+ s = ptr;
if (!(ret=iret=malloc(ictok*sizeof(char *))))
return NULL;