diff options
author | Brent Cook <bcook@openbsd.org> | 2014-08-02 21:43:56 -0500 |
---|---|---|
committer | Bob Beck <beck@openbsd.org> | 2014-08-04 10:44:56 -0600 |
commit | 5196a58dae2faf8edbbf54e7c2d0a3d741113301 (patch) | |
tree | e4ad05ffccc6b8adb31f0eef46a090aea749486f | |
parent | eb8ed5a532d74166a685413a0a69f16a1154ca15 (diff) | |
download | portable-5196a58dae2faf8edbbf54e7c2d0a3d741113301.tar.gz portable-5196a58dae2faf8edbbf54e7c2d0a3d741113301.tar.bz2 portable-5196a58dae2faf8edbbf54e7c2d0a3d741113301.zip |
conditionally build strnlen if needed.
it is only used by strndup
prodded by Sortie@
-rw-r--r-- | configure.ac.tpl | 5 | ||||
-rw-r--r-- | crypto/Makefile.am.tpl | 2 | ||||
-rw-r--r-- | include/string.h | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac.tpl b/configure.ac.tpl index b557687..87a571d 100644 --- a/configure.ac.tpl +++ b/configure.ac.tpl | |||
@@ -72,6 +72,11 @@ AC_CHECK_FUNC(strndup, | |||
72 | AC_DEFINE(NO_STRNDUP) | 72 | AC_DEFINE(NO_STRNDUP) |
73 | AM_CONDITIONAL(NO_STRNDUP, true)) | 73 | AM_CONDITIONAL(NO_STRNDUP, true)) |
74 | 74 | ||
75 | AC_CHECK_FUNC(strnlen, | ||
76 | AM_CONDITIONAL(NO_STRNLEN, false), | ||
77 | AC_DEFINE(NO_STRNLEN) | ||
78 | AM_CONDITIONAL(NO_STRNLEN, true)) | ||
79 | |||
75 | AC_CHECK_FUNC(asprintf, | 80 | AC_CHECK_FUNC(asprintf, |
76 | AM_CONDITIONAL(NO_ASPRINTF, false), | 81 | AM_CONDITIONAL(NO_ASPRINTF, false), |
77 | AC_DEFINE(NO_ASPRINTF) | 82 | AC_DEFINE(NO_ASPRINTF) |
diff --git a/crypto/Makefile.am.tpl b/crypto/Makefile.am.tpl index d203b7b..04ff7f7 100644 --- a/crypto/Makefile.am.tpl +++ b/crypto/Makefile.am.tpl | |||
@@ -35,8 +35,10 @@ endif | |||
35 | 35 | ||
36 | if NO_STRNDUP | 36 | if NO_STRNDUP |
37 | libcompat_la_SOURCES += compat/strndup.c | 37 | libcompat_la_SOURCES += compat/strndup.c |
38 | if NO_STRNLEN | ||
38 | libcompat_la_SOURCES += compat/strnlen.c | 39 | libcompat_la_SOURCES += compat/strnlen.c |
39 | endif | 40 | endif |
41 | endif | ||
40 | 42 | ||
41 | if NO_ASPRINTF | 43 | if NO_ASPRINTF |
42 | libcompat_la_SOURCES += compat/bsd-asprintf.c | 44 | libcompat_la_SOURCES += compat/bsd-asprintf.c |
diff --git a/include/string.h b/include/string.h index c4bf1e4..ab232a8 100644 --- a/include/string.h +++ b/include/string.h | |||
@@ -22,8 +22,10 @@ size_t strlcat(char *dst, const char *src, size_t siz); | |||
22 | 22 | ||
23 | #ifdef NO_STRNDUP | 23 | #ifdef NO_STRNDUP |
24 | char * strndup(const char *str, size_t maxlen); | 24 | char * strndup(const char *str, size_t maxlen); |
25 | #ifdef NO_STRNLEN | ||
25 | size_t strnlen(const char *str, size_t maxlen); | 26 | size_t strnlen(const char *str, size_t maxlen); |
26 | #endif | 27 | #endif |
28 | #endif | ||
27 | 29 | ||
28 | #ifdef NO_EXPLICIT_BZERO | 30 | #ifdef NO_EXPLICIT_BZERO |
29 | void explicit_bzero(void *, size_t); | 31 | void explicit_bzero(void *, size_t); |