From: Volker Lendecke Date: Wed, 19 Feb 2025 06:25:05 +0000 (+0100) Subject: lib: Remove unused next_token() X-Git-Tag: tevent-0.17.0~588 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd97a210d40f9f47509ee2f9d64dba52c5fe84ea;p=thirdparty%2Fsamba.git lib: Remove unused next_token() Replaced by next_token_talloc() Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h index 4316c1b2c6c..ab91c0abd43 100644 --- a/lib/util/charset/charset.h +++ b/lib/util/charset/charset.h @@ -165,7 +165,6 @@ int strncasecmp_ldb(const char *s1, int strncasecmp_m(const char *s1, const char *s2, size_t n); int strncasecmp_m_handle(struct smb_iconv_handle *iconv_handle, const char *s1, const char *s2, size_t n); -bool next_token(const char **ptr,char *buff, const char *sep, size_t bufsize); int strcasecmp_m_handle(struct smb_iconv_handle *iconv_handle, const char *s1, const char *s2); int strcasecmp_m(const char *s1, const char *s2); diff --git a/lib/util/util_str.c b/lib/util/util_str.c index 7c1d15dbeb0..19acff4a983 100644 --- a/lib/util/util_str.c +++ b/lib/util/util_str.c @@ -141,6 +141,14 @@ _PUBLIC_ bool strequal(const char *s1, const char *s2) * @brief String utilities. **/ +/** + * Get the next token from a string, return False if none found. + * Handles double-quotes. + * + * Based on a routine by GJC@VILLAGE.COM. + * Extensively modified by Andrew.Tridgell@anu.edu.au + **/ + static bool next_token_internal_talloc(TALLOC_CTX *ctx, const char **ptr, char **pp_buff, @@ -236,52 +244,6 @@ bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx, return next_token_internal_talloc(ctx, ptr, pp_buff, sep, false); } -/** - * Get the next token from a string, return False if none found. - * Handles double-quotes. - * - * Based on a routine by GJC@VILLAGE.COM. - * Extensively modified by Andrew.Tridgell@anu.edu.au - **/ -_PUBLIC_ bool next_token(const char **ptr,char *buff, const char *sep, size_t bufsize) -{ - const char *s; - bool quoted; - size_t len=1; - - if (!ptr) - return false; - - s = *ptr; - - /* default to simple separators */ - if (!sep) - sep = " \t\n\r"; - - /* find the first non sep char */ - while (*s && strchr_m(sep,*s)) - s++; - - /* nothing left? */ - if (!*s) - return false; - - /* copy over the token */ - for (quoted = false; len < bufsize && *s && (quoted || !strchr_m(sep,*s)); s++) { - if (*s == '\"') { - quoted = !quoted; - } else { - len++; - *buff++ = *s; - } - } - - *ptr = (*s) ? s+1 : s; - *buff = 0; - - return true; -} - /** Set a boolean variable from the text value stored in the passed string. Returns true in success, false if the passed string does not correctly diff --git a/source3/include/proto.h b/source3/include/proto.h index 8b446fa9f9e..75270c1a025 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -521,7 +521,6 @@ int poll_intr_one_fd(int fd, int events, int timeout, int *revents); /* The following definitions come from lib/util_str.c */ -bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize); bool strnequal(const char *s1,const char *s2,size_t n); bool strcsequal(const char *s1,const char *s2); char *skip_string(const char *base, size_t len, char *buf);