summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-05-03 12:59:36 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-05-03 07:37:07 +0200
commit2c32534d5ba5d009c48f377aa5aea8e77b4fa316 (patch)
treefe6dab5d77474d934bce7b30d4204cb2bffab2b0 /source3/lib/util_str.c
parent86a62ab4345b8567a346587d2ddf575523d0b5f8 (diff)
downloadsamba-2c32534d5ba5d009c48f377aa5aea8e77b4fa316.tar.gz
samba-2c32534d5ba5d009c48f377aa5aea8e77b4fa316.tar.bz2
samba-2c32534d5ba5d009c48f377aa5aea8e77b4fa316.zip
lib/util Use lib/util/util_str.c in common, including strequal()
strequal() is now implemented in terms of strcasecmp_m() which is tested in smbtorture and which does not talloc() for ASCII or non-ASCII comparions, and has an ASCII fast-path. Andrew Bartlett
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r--source3/lib/util_str.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 4d76cc0a9f..583eea40d9 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -179,21 +179,6 @@ int StrnCaseCmp(const char *s, const char *t, size_t len)
}
/**
- * Compare 2 strings.
- *
- * @note The comparison is case-insensitive.
- **/
-bool strequal(const char *s1, const char *s2)
-{
- if (s1 == s2)
- return(true);
- if (!s1 || !s2)
- return(false);
-
- return(StrCaseCmp(s1,s2)==0);
-}
-
-/**
* Compare 2 strings up to and including the nth char.
*
* @note The comparison is case-insensitive.
@@ -328,77 +313,6 @@ bool trim_char(char *s,char cfront,char cback)
}
/**
- Safe string copy into a known length string. maxlength does not
- include the terminating zero.
-**/
-
-char *safe_strcpy_fn(char *dest,
- const char *src,
- size_t maxlength)
-{
- size_t len;
-
- if (!dest) {
- smb_panic("ERROR: NULL dest in safe_strcpy");
- }
-
- if (!src) {
- *dest = 0;
- return dest;
- }
-
- len = strnlen(src, maxlength+1);
-
- if (len > maxlength) {
- DEBUG(0,("ERROR: string overflow by "
- "%lu (%lu - %lu) in safe_strcpy [%.50s]\n",
- (unsigned long)(len-maxlength), (unsigned long)len,
- (unsigned long)maxlength, src));
- len = maxlength;
- }
-
- memmove(dest, src, len);
- dest[len] = 0;
- return dest;
-}
-
-/**
- Safe string cat into a string. maxlength does not
- include the terminating zero.
-**/
-char *safe_strcat_fn(char *dest,
- const char *src,
- size_t maxlength)
-{
- size_t src_len, dest_len;
-
- if (!dest) {
- smb_panic("ERROR: NULL dest in safe_strcat");
- }
-
- if (!src)
- return dest;
-
- src_len = strnlen(src, maxlength + 1);
- dest_len = strnlen(dest, maxlength + 1);
-
- if (src_len + dest_len > maxlength) {
- DEBUG(0,("ERROR: string overflow by %d "
- "in safe_strcat [%.50s]\n",
- (int)(src_len + dest_len - maxlength), src));
- if (maxlength > dest_len) {
- memcpy(&dest[dest_len], src, maxlength - dest_len);
- }
- dest[maxlength] = 0;
- return NULL;
- }
-
- memcpy(&dest[dest_len], src, src_len);
- dest[dest_len + src_len] = 0;
- return dest;
-}
-
-/**
Like strncpy but always null terminates. Make sure there is room!
The variable n should always be one less than the available size.
**/