summaryrefslogtreecommitdiff
path: root/source4/client
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-24 01:21:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:07 -0500
commit5c94fcab923b85c2dd75664deb8fa2819ca5ea23 (patch)
tree961c6fa41fc821b3a1b5a2cba32a5cef02ea9892 /source4/client
parent1cf7a3420e501f023b0289a47adf0d89e2d12d17 (diff)
downloadsamba-5c94fcab923b85c2dd75664deb8fa2819ca5ea23.tar.gz
samba-5c94fcab923b85c2dd75664deb8fa2819ca5ea23.tar.bz2
samba-5c94fcab923b85c2dd75664deb8fa2819ca5ea23.zip
r2577: - I recently found out that charaters below 0x3F are guaranteed not to
occur as secondary bytes in any multi-byte character set. This allows for a very simple optimisation in strchr_m() and strrchr_m(). It might be a good idea to pick this up for Samba3. - the horrible toktocliplist() is only used in clitar.c, so move it there, to prevent anyone else from being tempted to use it. (This used to be commit 663b7b75ddd838ce547425b07d7ce4d4606fb479)
Diffstat (limited to 'source4/client')
-rw-r--r--source4/client/clitar.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source4/client/clitar.c b/source4/client/clitar.c
index 9ce9f27599..7797b686d5 100644
--- a/source4/client/clitar.c
+++ b/source4/client/clitar.c
@@ -38,6 +38,52 @@
#include "includes.h"
#include "clitar.h"
+/**
+ Convert list of tokens to array; dependent on above routine.
+ Uses last_ptr from above - bit of a hack.
+**/
+
+static char **toktocliplist(const char *ptr, int *ctok, const char *sep)
+{
+ char *s = 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 = ptr;
+
+ if (!(ret=iret=malloc(ictok*sizeof(char *))))
+ return NULL;
+
+ while(ictok--) {
+ *iret++=s;
+ while(*s++)
+ ;
+ while(!*s)
+ s++;
+ }
+
+ return ret;
+}
+
static int clipfind(char **aret, int ret, char *tok);
void dos_clean_name(char *s);