aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-22 02:20:52 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-22 02:20:52 +0000
commit4ec5e139c8442b321ef9b58684da547ea0388261 (patch)
tree70601b682cc85875f18891293e182770cab2fc95 /src/common/compat.h
parentd23cb33a1a7c2fb8e16040826ec2bbda607468c5 (diff)
downloadtor-4ec5e139c8442b321ef9b58684da547ea0388261.tar
tor-4ec5e139c8442b321ef9b58684da547ea0388261.tar.gz
r12850@catbus: nickm | 2007-05-21 22:20:42 -0400
Partial backport candidate: do not rely on finding a \0 after an mmaped() router/extrainfo file. Also, set journal length correctly when starting up. svn:r10248
Diffstat (limited to 'src/common/compat.h')
-rw-r--r--src/common/compat.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index e5862f982..085af036d 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -161,6 +161,13 @@ int tor_vsnprintf(char *str, size_t size, const char *format, va_list args)
const void *tor_memmem(const void *haystack, size_t hlen, const void *needle,
size_t nlen) ATTR_PURE ATTR_NONNULL((1,3));
+static const void *tor_memstr(const void *haystack, size_t hlen,
+ const char *needle) ATTR_PURE ATTR_NONNULL((1,3));
+static INLINE const void *
+tor_memstr(const void *haystack, size_t hlen, const char *needle)
+{
+ return tor_memmem(haystack, hlen, needle, strlen(needle));
+}
#define TOR_ISALPHA(c) isalpha((int)(unsigned char)(c))
#define TOR_ISALNUM(c) isalnum((int)(unsigned char)(c))