mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-23 20:03:31 +01:00
Define a strnlen replacement on platforms (win32) that lack it
Right now this is only needed for test_util_format_time_interval, so define it as a static function. We can move it into compat later if we need to.
This commit is contained in:
parent
d950e24332
commit
21fe945ebd
@ -365,6 +365,7 @@ AC_CHECK_FUNCS(
|
||||
socketpair \
|
||||
strlcat \
|
||||
strlcpy \
|
||||
strnlen \
|
||||
strptime \
|
||||
strtok_r \
|
||||
strtoull \
|
||||
|
@ -2072,6 +2072,17 @@ test_util_sscanf(void *arg)
|
||||
#define tt_char_op(a,op,b) tt_assert_op_type(a,op,b,char,"%c")
|
||||
#define tt_ci_char_op(a,op,b) tt_char_op(tolower(a),op,tolower(b))
|
||||
|
||||
#ifndef HAVE_STRNLEN
|
||||
static size_t
|
||||
strnlen(const char *s, size_t len)
|
||||
{
|
||||
const char *p = memchr(s, 0, len);
|
||||
if (!p)
|
||||
return len;
|
||||
return p - s;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_util_format_time_interval(void *arg)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user