diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-12-17 09:04:25 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-12-17 09:04:25 -0500 |
commit | 29254812a3428da4ffeaede5d211364d942f94ab (patch) | |
tree | 21c56c997dadd50b4852c868bc15d488082120b1 /src | |
parent | a0fad3981e9d072188c6ba19f25bdd78962330d8 (diff) | |
download | tor-29254812a3428da4ffeaede5d211364d942f94ab.tar.gz tor-29254812a3428da4ffeaede5d211364d942f94ab.zip |
Remove strcmp_len(): it is now unused
(See 28856.)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/string/util_string.c | 15 | ||||
-rw-r--r-- | src/lib/string/util_string.h | 1 | ||||
-rw-r--r-- | src/test/test_util.c | 9 |
3 files changed, 0 insertions, 25 deletions
diff --git a/src/lib/string/util_string.c b/src/lib/string/util_string.c index e76e73046f..36e19d029c 100644 --- a/src/lib/string/util_string.c +++ b/src/lib/string/util_string.c @@ -212,21 +212,6 @@ strcmpstart(const char *s1, const char *s2) return strncmp(s1, s2, n); } -/** Compare the s1_len-byte string <b>s1</b> with <b>s2</b>, - * without depending on a terminating nul in s1. Sorting order is first by - * length, then lexically; return values are as for strcmp. - */ -int -strcmp_len(const char *s1, const char *s2, size_t s1_len) -{ - size_t s2_len = strlen(s2); - if (s1_len < s2_len) - return -1; - if (s1_len > s2_len) - return 1; - return fast_memcmp(s1, s2, s2_len); -} - /** Compares the first strlen(s2) characters of s1 with s2. Returns as for * strcasecmp. */ diff --git a/src/lib/string/util_string.h b/src/lib/string/util_string.h index 99467a27c3..6541afa4cb 100644 --- a/src/lib/string/util_string.h +++ b/src/lib/string/util_string.h @@ -33,7 +33,6 @@ int tor_strisnonupper(const char *s); int tor_strisspace(const char *s); int strcmp_opt(const char *s1, const char *s2); int strcmpstart(const char *s1, const char *s2); -int strcmp_len(const char *s1, const char *s2, size_t len); int strcasecmpstart(const char *s1, const char *s2); int strcmpend(const char *s1, const char *s2); int strcasecmpend(const char *s1, const char *s2); diff --git a/src/test/test_util.c b/src/test/test_util.c index 2b4d64e42e..7ac1a1ec42 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -2153,15 +2153,6 @@ test_util_strmisc(void *arg) tt_int_op(strcmp_opt(NULL, "foo"), OP_LT, 0); tt_int_op(strcmp_opt("foo", NULL), OP_GT, 0); - /* Test strcmp_len */ - tt_int_op(strcmp_len("foo", "bar", 3), OP_GT, 0); - tt_int_op(strcmp_len("foo", "bar", 2), OP_LT, 0); - tt_int_op(strcmp_len("foo2", "foo1", 4), OP_GT, 0); - tt_int_op(strcmp_len("foo2", "foo1", 3), OP_LT, 0); /* Really stop at len */ - tt_int_op(strcmp_len("foo2", "foo", 3), OP_EQ, 0); /* Really stop at len */ - tt_int_op(strcmp_len("blah", "", 4), OP_GT, 0); - tt_int_op(strcmp_len("blah", "", 0), OP_EQ, 0); - done: tor_free(cp_tmp); } |