mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
Remove strcmp_len(): it is now unused
(See 28856.)
This commit is contained in:
parent
a0fad3981e
commit
29254812a3
@ -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.
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user