aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2014-08-02 21:43:56 -0500
committerBob Beck <beck@openbsd.org>2014-08-04 10:44:56 -0600
commit5196a58dae2faf8edbbf54e7c2d0a3d741113301 (patch)
treee4ad05ffccc6b8adb31f0eef46a090aea749486f
parenteb8ed5a532d74166a685413a0a69f16a1154ca15 (diff)
downloadportable-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.tpl5
-rw-r--r--crypto/Makefile.am.tpl2
-rw-r--r--include/string.h2
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
75AC_CHECK_FUNC(strnlen,
76 AM_CONDITIONAL(NO_STRNLEN, false),
77 AC_DEFINE(NO_STRNLEN)
78 AM_CONDITIONAL(NO_STRNLEN, true))
79
75AC_CHECK_FUNC(asprintf, 80AC_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
36if NO_STRNDUP 36if NO_STRNDUP
37libcompat_la_SOURCES += compat/strndup.c 37libcompat_la_SOURCES += compat/strndup.c
38if NO_STRNLEN
38libcompat_la_SOURCES += compat/strnlen.c 39libcompat_la_SOURCES += compat/strnlen.c
39endif 40endif
41endif
40 42
41if NO_ASPRINTF 43if NO_ASPRINTF
42libcompat_la_SOURCES += compat/bsd-asprintf.c 44libcompat_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
24char * strndup(const char *str, size_t maxlen); 24char * strndup(const char *str, size_t maxlen);
25#ifdef NO_STRNLEN
25size_t strnlen(const char *str, size_t maxlen); 26size_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
29void explicit_bzero(void *, size_t); 31void explicit_bzero(void *, size_t);