[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-91-g54bc27e

Jelmer Vernooij jelmer at samba.org
Sun Mar 1 15:24:24 GMT 2009


The branch, master has been updated
       via  54bc27e9374742d37b1ed9012d1cfe8f5ace6d40 (commit)
       via  55903e6f9120f1ec58a8554813229975c3028a09 (commit)
       via  d776ac03c3ce8a9090b847f20d2cdd16d745441f (commit)
      from  4a35c974e97551b1ccbfa41d4c08f0598e3c26aa (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 54bc27e9374742d37b1ed9012d1cfe8f5ace6d40
Merge: 55903e6f9120f1ec58a8554813229975c3028a09 4a35c974e97551b1ccbfa41d4c08f0598e3c26aa
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Mar 1 16:23:53 2009 +0100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba into talloc-next

commit 55903e6f9120f1ec58a8554813229975c3028a09
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Mar 1 16:19:38 2009 +0100

    Move next_token_talloc to util.c, as util_str.c is only compiled inside samba 4.

commit d776ac03c3ce8a9090b847f20d2cdd16d745441f
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Mar 1 16:16:16 2009 +0100

    Move next_token_talloc() to top-level.

-----------------------------------------------------------------------

Summary of changes:
 lib/util/util.c        |  100 ++++++++++++++++++++++++++++++++++++++++++
 lib/util/util.h        |   15 ++++++
 source3/lib/util_str.c |  112 ------------------------------------------------
 3 files changed, 115 insertions(+), 112 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/util.c b/lib/util/util.c
index 988d8f9..1f31f55 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -836,4 +836,104 @@ _PUBLIC_ size_t utf16_len_n(const void *src, size_t n)
 	return len;
 }
 
+/**
+ * @file
+ * @brief String utilities.
+ **/
+
+static bool next_token_internal_talloc(TALLOC_CTX *ctx,
+				const char **ptr,
+                                char **pp_buff,
+                                const char *sep,
+                                bool ltrim)
+{
+	char *s;
+	char *saved_s;
+	char *pbuf;
+	bool quoted;
+	size_t len=1;
+
+	*pp_buff = NULL;
+	if (!ptr) {
+		return(false);
+	}
+
+	s = (char *)*ptr;
+
+	/* default to simple separators */
+	if (!sep) {
+		sep = " \t\n\r";
+	}
+
+	/* find the first non sep char, if left-trimming is requested */
+	if (ltrim) {
+		while (*s && strchr_m(sep,*s)) {
+			s++;
+		}
+	}
+
+	/* nothing left? */
+	if (!*s) {
+		return false;
+	}
+
+	/* When restarting we need to go from here. */
+	saved_s = s;
+
+	/* Work out the length needed. */
+	for (quoted = false; *s &&
+			(quoted || !strchr_m(sep,*s)); s++) {
+		if (*s == '\"') {
+			quoted = !quoted;
+		} else {
+			len++;
+		}
+	}
+
+	/* We started with len = 1 so we have space for the nul. */
+	*pp_buff = talloc_array(ctx, char, len);
+	if (!*pp_buff) {
+		return false;
+	}
+
+	/* copy over the token */
+	pbuf = *pp_buff;
+	s = saved_s;
+	for (quoted = false; *s &&
+			(quoted || !strchr_m(sep,*s)); s++) {
+		if ( *s == '\"' ) {
+			quoted = !quoted;
+		} else {
+			*pbuf++ = *s;
+		}
+	}
+
+	*ptr = (*s) ? s+1 : s;
+	*pbuf = 0;
+
+	return true;
+}
+
+bool next_token_talloc(TALLOC_CTX *ctx,
+			const char **ptr,
+			char **pp_buff,
+			const char *sep)
+{
+	return next_token_internal_talloc(ctx, ptr, pp_buff, sep, true);
+}
+
+/*
+ * Get the next token from a string, return false if none found.  Handles
+ * double-quotes.  This version does not trim leading separator characters
+ * before looking for a token.
+ */
+
+bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
+			const char **ptr,
+			char **pp_buff,
+			const char *sep)
+{
+	return next_token_internal_talloc(ctx, ptr, pp_buff, sep, false);
+}
+
 
diff --git a/lib/util/util.h b/lib/util/util.h
index 27f94cd..1f6e3b1 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -204,6 +204,21 @@ _PUBLIC_ void display_set_stderr(void);
 
 /* The following definitions come from lib/util/util_str.c  */
 
+bool next_token_talloc(TALLOC_CTX *ctx,
+			const char **ptr,
+			char **pp_buff,
+			const char *sep);
+
+/**
+ * Get the next token from a string, return false if none found.  Handles
+ * double-quotes.  This version does not trim leading separator characters
+ * before looking for a token.
+ */
+bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
+			const char **ptr,
+			char **pp_buff,
+			const char *sep);
+
 
 /**
  Trim the specified elements off the front and back of a string.
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 9358061..b9ccb83 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -36,118 +36,6 @@ const char toupper_ascii_fast_table[128] = {
 };
 
 /**
- * @file
- * @brief String utilities.
- **/
-
-static bool next_token_internal_talloc(TALLOC_CTX *ctx,
-				const char **ptr,
-                                char **pp_buff,
-                                const char *sep,
-                                bool ltrim)
-{
-	char *s;
-	char *saved_s;
-	char *pbuf;
-	bool quoted;
-	size_t len=1;
-
-	*pp_buff = NULL;
-	if (!ptr) {
-		return(false);
-	}
-
-	s = (char *)*ptr;
-
-	/* default to simple separators */
-	if (!sep) {
-		sep = " \t\n\r";
-	}
-
-	/* find the first non sep char, if left-trimming is requested */
-	if (ltrim) {
-		while (*s && strchr_m(sep,*s)) {
-			s++;
-		}
-	}
-
-	/* nothing left? */
-	if (!*s) {
-		return false;
-	}
-
-	/* When restarting we need to go from here. */
-	saved_s = s;
-
-	/* Work out the length needed. */
-	for (quoted = false; *s &&
-			(quoted || !strchr_m(sep,*s)); s++) {
-		if (*s == '\"') {
-			quoted = !quoted;
-		} else {
-			len++;
-		}
-	}
-
-	/* We started with len = 1 so we have space for the nul. */
-	*pp_buff = TALLOC_ARRAY(ctx, char, len);
-	if (!*pp_buff) {
-		return false;
-	}
-
-	/* copy over the token */
-	pbuf = *pp_buff;
-	s = saved_s;
-	for (quoted = false; *s &&
-			(quoted || !strchr_m(sep,*s)); s++) {
-		if ( *s == '\"' ) {
-			quoted = !quoted;
-		} else {
-			*pbuf++ = *s;
-		}
-	}
-
-	*ptr = (*s) ? s+1 : s;
-	*pbuf = 0;
-
-	return true;
-}
-
-#if 0
-/*
- * Get the next token from a string, return false if none found.  Handles
- * double-quotes.  This version trims leading separator characters before
- * looking for a token.
- */
-bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize)
-{
-	return next_token_internal(ptr, buff, sep, bufsize, true);
-}
-#endif
-
-bool next_token_talloc(TALLOC_CTX *ctx,
-			const char **ptr,
-			char **pp_buff,
-			const char *sep)
-{
-	return next_token_internal_talloc(ctx, ptr, pp_buff, sep, true);
-}
-
-/*
- * Get the next token from a string, return false if none found.  Handles
- * double-quotes.  This version does not trim leading separator characters
- * before looking for a token.
- */
-
-bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
-			const char **ptr,
-			char **pp_buff,
-			const char *sep)
-{
-	return next_token_internal_talloc(ctx, ptr, pp_buff, sep, false);
-}
-
-/**
  * Case insensitive string compararison.
  *
  * iconv does not directly give us a way to compare strings in


-- 
Samba Shared Repository


More information about the samba-cvs mailing list