aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2014-10-29 15:44:36 -0500
committerBrent Cook <bcook@openbsd.org>2014-10-30 19:15:11 -0500
commita4cc953911a745d6e769a03cbe6442ee2fc27cbd (patch)
tree8c26006db95beb6249b755e108ee1aa317e742bd /include
parent727bccd093eaeac853ac84c7b6f31e67e452cde9 (diff)
downloadportable-a4cc953911a745d6e769a03cbe6442ee2fc27cbd.tar.gz
portable-a4cc953911a745d6e769a03cbe6442ee2fc27cbd.tar.bz2
portable-a4cc953911a745d6e769a03cbe6442ee2fc27cbd.zip
Improve and simplify function and header detection logic.
Simplify autoconf checks by using AC_CHECK_FUNCS/HEADERS. Clarify some ambiguous dependencies around strnlen/strndup. Unconditionally enable pidwraptest for all arc4random implementations. Remove HAVE_VASPRINTF conditional, since asprintf requires vasprintf. ok @doug
Diffstat (limited to 'include')
-rw-r--r--include/stdio.h2
-rw-r--r--include/stdlib.h6
-rw-r--r--include/string.h17
-rw-r--r--include/unistd.h4
4 files changed, 15 insertions, 14 deletions
diff --git a/include/stdio.h b/include/stdio.h
index fffa170..4a40f6a 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -3,7 +3,7 @@
3#ifndef LIBCRYPTOCOMPAT_STDIO_H 3#ifndef LIBCRYPTOCOMPAT_STDIO_H
4#define LIBCRYPTOCOMPAT_STDIO_H 4#define LIBCRYPTOCOMPAT_STDIO_H
5 5
6#ifdef NO_ASPRINTF 6#ifndef HAVE_ASPRINTF
7#include <stdarg.h> 7#include <stdarg.h>
8int vasprintf(char **str, const char *fmt, va_list ap); 8int vasprintf(char **str, const char *fmt, va_list ap);
9int asprintf(char **str, const char *fmt, ...); 9int asprintf(char **str, const char *fmt, ...);
diff --git a/include/stdlib.h b/include/stdlib.h
index c314f38..1a1cb6c 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -7,16 +7,16 @@
7#include <sys/time.h> 7#include <sys/time.h>
8#include <stdint.h> 8#include <stdint.h>
9 9
10#ifdef NO_ARC4RANDOM_BUF 10#ifndef HAVE_ARC4RANDOM_BUF
11uint32_t arc4random(void); 11uint32_t arc4random(void);
12void arc4random_buf(void *_buf, size_t n); 12void arc4random_buf(void *_buf, size_t n);
13#endif 13#endif
14 14
15#ifdef NO_REALLOCARRAY 15#ifndef HAVE_REALLOCARRAY
16void *reallocarray(void *, size_t, size_t); 16void *reallocarray(void *, size_t, size_t);
17#endif 17#endif
18 18
19#ifdef NO_STRTONUM 19#ifndef HAVE_STRTONUM
20long long strtonum(const char *nptr, long long minval, 20long long strtonum(const char *nptr, long long minval,
21 long long maxval, const char **errstr); 21 long long maxval, const char **errstr);
22#endif 22#endif
diff --git a/include/string.h b/include/string.h
index f092477..47ada28 100644
--- a/include/string.h
+++ b/include/string.h
@@ -12,34 +12,35 @@
12#include <strings.h> 12#include <strings.h>
13#endif 13#endif
14 14
15#ifdef NO_STRLCPY 15#ifndef HAVE_STRLCPY
16size_t strlcpy(char *dst, const char *src, size_t siz); 16size_t strlcpy(char *dst, const char *src, size_t siz);
17#endif 17#endif
18 18
19#ifdef NO_STRLCAT 19#ifndef HAVE_STRLCAT
20size_t strlcat(char *dst, const char *src, size_t siz); 20size_t strlcat(char *dst, const char *src, size_t siz);
21#endif 21#endif
22 22
23#ifdef NO_STRNDUP 23#ifndef HAVE_STRNDUP
24char * strndup(const char *str, size_t maxlen); 24char * strndup(const char *str, size_t maxlen);
25#ifdef NO_STRNLEN 25/* the only user of strnlen is strndup, so only build it if needed */
26#ifndef HAVE_STRNLEN
26size_t strnlen(const char *str, size_t maxlen); 27size_t strnlen(const char *str, size_t maxlen);
27#endif 28#endif
28#endif 29#endif
29 30
30#ifdef NO_EXPLICIT_BZERO 31#ifndef HAVE_EXPLICIT_BZERO
31void explicit_bzero(void *, size_t); 32void explicit_bzero(void *, size_t);
32#endif 33#endif
33 34
34#ifdef NO_TIMINGSAFE_BCMP 35#ifndef HAVE_TIMINGSAFE_BCMP
35int timingsafe_bcmp(const void *b1, const void *b2, size_t n); 36int timingsafe_bcmp(const void *b1, const void *b2, size_t n);
36#endif 37#endif
37 38
38#ifdef NO_TIMINGSAFE_MEMCMP 39#ifndef HAVE_TIMINGSAFE_MEMCMP
39int timingsafe_memcmp(const void *b1, const void *b2, size_t len); 40int timingsafe_memcmp(const void *b1, const void *b2, size_t len);
40#endif 41#endif
41 42
42#ifdef NO_MEMMEM 43#ifndef HAVE_MEMMEM
43void * memmem(const void *big, size_t big_len, const void *little, 44void * memmem(const void *big, size_t big_len, const void *little,
44 size_t little_len); 45 size_t little_len);
45#endif 46#endif
diff --git a/include/unistd.h b/include/unistd.h
index 037b11a..38caeb1 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -3,11 +3,11 @@
3#ifndef LIBCRYPTOCOMPAT_UNISTD_H 3#ifndef LIBCRYPTOCOMPAT_UNISTD_H
4#define LIBCRYPTOCOMPAT_UNISTD_H 4#define LIBCRYPTOCOMPAT_UNISTD_H
5 5
6#ifdef NO_GETENTROPY 6#ifndef HAVE_GETENTROPY
7int getentropy(void *buf, size_t buflen); 7int getentropy(void *buf, size_t buflen);
8#endif 8#endif
9 9
10#ifdef NO_ISSETUGID 10#ifndef HAVE_ISSETUGID
11int issetugid(void); 11int issetugid(void);
12#endif 12#endif
13 13