diff options
-rw-r--r-- | configure.in | 7 | ||||
-rw-r--r-- | src/common/compat.c | 8 | ||||
-rw-r--r-- | src/common/compat.h | 6 | ||||
-rw-r--r-- | src/common/util.c | 8 | ||||
-rw-r--r-- | src/common/util.h | 3 |
5 files changed, 17 insertions, 15 deletions
diff --git a/configure.in b/configure.in index 50d952dde3..2b63da3d99 100644 --- a/configure.in +++ b/configure.in @@ -143,8 +143,7 @@ dnl These headers are not essential AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/param.h sys/wait.h sys/limits.h netinet/in.h arpa/inet.h machine/limits.h syslog.h sys/time.h sys/resource.h) -AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit setrlimit) -AC_REPLACE_FUNCS(strlcat strlcpy) +AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit setrlimit strlcat strlcpy) AC_CHECK_MEMBERS([struct timeval.tv_sec]) @@ -233,10 +232,10 @@ AC_SUBST(LOCALSTATEDIR) # Set CFLAGS _after_ all the above checks, since our warnings are stricter # than autoconf's macros like. -CFLAGS="$CFLAGS -Wall -W -Wno-unused-parameter -Wfloat-equal -Wdeclaration-after-statement -Wundef -Wendif-labels -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -g -O2" +CFLAGS="$CFLAGS -Wall -W -Wno-unused-parameter -Wfloat-equal -Wundef -Wendif-labels -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -g -O2" # Add these in when you feel like fun. -# -Wbad-function-cast -Werror +# -Wbad-function-cast -Werror -Wdeclaration-after-statement echo "confdir: $CONFDIR" diff --git a/src/common/compat.c b/src/common/compat.c index 58ba52c375..649d99e8fc 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -68,6 +68,14 @@ #include "log.h" #include "util.h" +/* Inline the strl functions if the plaform doesn't have them. */ +#ifndef HAVE_STRLCPY +#include "strlcpy.c" +#endif +#ifndef HAVE_STRLCAT +#include "strlcat.c" +#endif + /** Replacement for snprintf. Differs from platform snprintf in two * ways: First, always NUL-terminates its output. Second, always * returns -1 if the result is truncated. (Note that this return diff --git a/src/common/compat.h b/src/common/compat.h index 50acd42444..707a349f0b 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -55,6 +55,12 @@ #define strncasecmp strnicmp #define strcasecmp stricmp #endif +#ifndef HAVE_STRLCAT +size_t strlcat(char *dst, const char *src, size_t siz); +#endif +#ifndef HAVE_STRLCPY +size_t strlcpy(char *dst, const char *src, size_t siz); +#endif int tor_snprintf(char *str, size_t size, const char *format, ...) CHECK_PRINTF(3,4); diff --git a/src/common/util.c b/src/common/util.c index 60496d3940..ffe217c696 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -88,14 +88,6 @@ #define INADDR_NONE ((unsigned long) -1) #endif -/* Inline the strl functions if the plaform doesn't have them. */ -#ifndef HAVE_STRLCPY -#include "strlcpy.c" -#endif -#ifndef HAVE_STRLCAT -#include "strlcat.c" -#endif - #ifndef O_BINARY #define O_BINARY 0 #endif diff --git a/src/common/util.h b/src/common/util.h index 0fa51532d8..ae5ab9dc57 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -46,9 +46,6 @@ char *tor_strndup(const char *s, size_t n); /* String manipulation */ #define HEX_CHARACTERS "0123456789ABCDEFabcdef" -size_t strlcat(char *dst, const char *src, size_t siz); -size_t strlcpy(char *dst, const char *src, size_t siz); - void tor_strlower(char *s); int strcmpstart(const char *s1, const char *s2); int tor_strstrip(char *s, const char *strip); |