aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-22 11:18:19 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-22 11:18:19 -0400
commit90a09df5ba7b3e55ea388a4cc9b92161442bb380 (patch)
tree1e50692d10ede2ddcf2c8b271a9c086c0a7d189e /src/common
parentbfb39164ce49450fad11611a129dd875acebde54 (diff)
downloadtor-90a09df5ba7b3e55ea388a4cc9b92161442bb380.tar.gz
tor-90a09df5ba7b3e55ea388a4cc9b92161442bb380.zip
Extract strlcpy and strlcmp to libtor-string
Diffstat (limited to 'src/common')
-rw-r--r--src/common/.may_include2
-rw-r--r--src/common/compat.c8
-rw-r--r--src/common/compat.h26
3 files changed, 1 insertions, 35 deletions
diff --git a/src/common/.may_include b/src/common/.may_include
index d2a3d2fff3..484b57e100 100644
--- a/src/common/.may_include
+++ b/src/common/.may_include
@@ -8,7 +8,5 @@ linux_syscalls.inc
micro-revision.i
siphash.h
src/ext/timeouts/timeout.c
-strlcat.c
-strlcpy.c
tor_queue.h
tor_readpassphrase.h
diff --git a/src/common/compat.c b/src/common/compat.c
index 351fa05634..1dcd065810 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -131,14 +131,6 @@ SecureZeroMemory(PVOID ptr, SIZE_T cnt)
#include "common/address.h"
#include "common/sandbox.h"
-/* Inline the strl functions if the platform doesn't have them. */
-#ifndef HAVE_STRLCPY
-#include "strlcpy.c"
-#endif
-#ifndef HAVE_STRLCAT
-#include "strlcat.c"
-#endif
-
/* When set_max_file_descriptors() is called, update this with the max file
* descriptor value so we can use it to check the limit when opening a new
* socket. Default value is what Debian sets as the default hard limit. */
diff --git a/src/common/compat.h b/src/common/compat.h
index 21fd0211a3..605438cc62 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -48,6 +48,7 @@
#include "lib/cc/compat_compiler.h"
#include "common/compat_time.h"
#include "lib/string/compat_ctype.h"
+#include "lib/string/compat_string.h"
#include "lib/string/printf.h"
#include <stdio.h>
@@ -55,31 +56,6 @@
/* ===== Compiler compatibility */
-/* ===== String compatibility */
-#ifdef _WIN32
-/* Windows names string functions differently from most other platforms. */
-#define strncasecmp _strnicmp
-#define strcasecmp _stricmp
-#endif
-
-#if defined __APPLE__
-/* On OSX 10.9 and later, the overlap-checking code for strlcat would
- * appear to have a severe bug that can sometimes cause aborts in Tor.
- * Instead, use the non-checking variants. This is sad.
- *
- * See https://trac.torproject.org/projects/tor/ticket/15205
- */
-#undef strlcat
-#undef strlcpy
-#endif /* defined __APPLE__ */
-
-#ifndef HAVE_STRLCAT
-size_t strlcat(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2));
-#endif
-#ifndef HAVE_STRLCPY
-size_t strlcpy(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2));
-#endif
-
/** Represents an mmaped file. Allocated via tor_mmap_file; freed with
* tor_munmap_file. */
typedef struct tor_mmap_t {