diff options
| author | Pauli <[email protected]> | 2026-01-13 22:13:52 +0100 |
|---|---|---|
| committer | Pauli <[email protected]> | 2026-01-15 22:31:20 +0100 |
| commit | b79ec4cb221dbc5b5fdee2db0dc8fd2aa8d2306f (patch) | |
| tree | 658a7914acaba859b39d05cb049afc91c2fb3582 /test/testutil | |
| parent | Fix search pattern in check-news-changes CI job (diff) | |
| download | openssl-b79ec4cb221dbc5b5fdee2db0dc8fd2aa8d2306f.tar.gz openssl-b79ec4cb221dbc5b5fdee2db0dc8fd2aa8d2306f.zip | |
test: get rid of the TEST_strn2_ functions
Their semantics are poorly defined and they are rarely used. The _ne
version being completely unused & tricky to define properly.
Reviewed-by: Norbert Pocs <[email protected]>
Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Frederik Wedel-Heinen <[email protected]>
(Merged from https://github.com/openssl/openssl/pull/29627)
Diffstat (limited to 'test/testutil')
| -rw-r--r-- | test/testutil/tests.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/testutil/tests.c b/test/testutil/tests.c index f67b5ce4bfa..ee83f8a4a96 100644 --- a/test/testutil/tests.c +++ b/test/testutil/tests.c @@ -302,28 +302,28 @@ int test_str_ne(const char *file, int line, const char *st1, const char *st2, } int test_strn_eq(const char *file, int line, const char *st1, const char *st2, - const char *s1, size_t n1, const char *s2, size_t n2) + const char *s1, const char *s2, size_t n) { if (s1 == NULL && s2 == NULL) return 1; - if (n1 != n2 || s1 == NULL || s2 == NULL || strncmp(s1, s2, n1) != 0) { + if (s1 == NULL || s2 == NULL || strncmp(s1, s2, n) != 0) { test_fail_string_message(NULL, file, line, "string", st1, st2, "==", - s1, s1 == NULL ? 0 : OPENSSL_strnlen(s1, n1), - s2, s2 == NULL ? 0 : OPENSSL_strnlen(s2, n2)); + s1, s1 == NULL ? 0 : OPENSSL_strnlen(s1, n), + s2, s2 == NULL ? 0 : OPENSSL_strnlen(s2, n)); return 0; } return 1; } int test_strn_ne(const char *file, int line, const char *st1, const char *st2, - const char *s1, size_t n1, const char *s2, size_t n2) + const char *s1, const char *s2, size_t n) { if ((s1 == NULL) ^ (s2 == NULL)) return 1; - if (n1 != n2 || s1 == NULL || strncmp(s1, s2, n1) == 0) { + if (s1 == NULL || strncmp(s1, s2, n) == 0) { test_fail_string_message(NULL, file, line, "string", st1, st2, "!=", - s1, s1 == NULL ? 0 : OPENSSL_strnlen(s1, n1), - s2, s2 == NULL ? 0 : OPENSSL_strnlen(s2, n2)); + s1, s1 == NULL ? 0 : OPENSSL_strnlen(s1, n), + s2, s2 == NULL ? 0 : OPENSSL_strnlen(s2, n)); return 0; } return 1; |
