mirror of
https://github.com/samba-team/samba.git
synced 2025-12-14 20:23:54 +03:00
Remove next_token_nr_talloc and its associated global
Only client.c and clitar.c used this, I think they should carry the static themselves. Also move the a bit funny routine toktocliplist to clitar.c, the only place where it is used.
This commit is contained in:
@@ -136,83 +136,6 @@ bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
|
||||
return next_token_internal_talloc(ctx, ptr, pp_buff, sep, false);
|
||||
}
|
||||
|
||||
/**
|
||||
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 const char *last_ptr=NULL;
|
||||
|
||||
bool next_token_nr_talloc(TALLOC_CTX *ctx,
|
||||
const char **ptr,
|
||||
char **pp_buff,
|
||||
const char *sep)
|
||||
{
|
||||
bool ret;
|
||||
if (!ptr) {
|
||||
ptr = &last_ptr;
|
||||
}
|
||||
|
||||
ret = next_token_talloc(ctx, ptr, pp_buff, sep);
|
||||
last_ptr = *ptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void set_first_token(char *ptr)
|
||||
{
|
||||
last_ptr = ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert list of tokens to array; dependent on above routine.
|
||||
Uses last_ptr from above - bit of a hack.
|
||||
**/
|
||||
|
||||
char **toktocliplist(int *ctok, const char *sep)
|
||||
{
|
||||
char *s=(char *)last_ptr;
|
||||
int ictok=0;
|
||||
char **ret, **iret;
|
||||
|
||||
if (!sep)
|
||||
sep = " \t\n\r";
|
||||
|
||||
while(*s && strchr_m(sep,*s))
|
||||
s++;
|
||||
|
||||
/* nothing left? */
|
||||
if (!*s)
|
||||
return(NULL);
|
||||
|
||||
do {
|
||||
ictok++;
|
||||
while(*s && (!strchr_m(sep,*s)))
|
||||
s++;
|
||||
while(*s && strchr_m(sep,*s))
|
||||
*s++=0;
|
||||
} while(*s);
|
||||
|
||||
*ctok=ictok;
|
||||
s=(char *)last_ptr;
|
||||
|
||||
if (!(ret=iret=SMB_MALLOC_ARRAY(char *,ictok+1)))
|
||||
return NULL;
|
||||
|
||||
while(ictok--) {
|
||||
*iret++=s;
|
||||
if (ictok > 0) {
|
||||
while(*s++)
|
||||
;
|
||||
while(!*s)
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
ret[*ctok] = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Case insensitive string compararison.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user