diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-11-02 19:25:52 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-11-02 19:25:52 +0000 |
commit | 67f14032b18b7b46a56bd32ccb88923588603164 (patch) | |
tree | e226b607d34b77df664416b3ee2d123ecf4e88d1 /src/common | |
parent | 509c0bdc22c5c36b8f6048e9beef852875de85d2 (diff) | |
download | tor-67f14032b18b7b46a56bd32ccb88923588603164.tar.gz tor-67f14032b18b7b46a56bd32ccb88923588603164.zip |
Handle strlcat/strlcpy correctly on platforms that have them.
svn:r2647
Diffstat (limited to 'src/common')
-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 |
4 files changed, 14 insertions, 11 deletions
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); |