summaryrefslogtreecommitdiff
path: root/src/common/compat.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-08-09 17:27:35 -0700
committerNick Mathewson <nickm@torproject.org>2009-08-09 17:30:15 -0700
commit3886467f386732598647a2d3209777ba8d8d7baa (patch)
treecc240f735afa1073dbdc0bb442f015d358ff7a0c /src/common/compat.h
parent6423091f071dc7c843d0fd02ac32b880b7754b24 (diff)
downloadtor-3886467f386732598647a2d3209777ba8d8d7baa.tar.gz
tor-3886467f386732598647a2d3209777ba8d8d7baa.zip
Add a new tor_strtok_r for platforms that don't have one, plus tests.
I don't think we actually use (or plan to use) strtok_r in a reentrant way anywhere in our code, but would be nice not to have to think about whether we're doing it.
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 4d5a016cf2..3d429486e8 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -267,6 +267,13 @@ extern const char TOR_TOLOWER_TABLE[];
#define TOR_TOLOWER(c) (TOR_TOLOWER_TABLE[(uint8_t)c])
#define TOR_TOUPPER(c) (TOR_TOUPPER_TABLE[(uint8_t)c])
+char *tor_strtok_r_impl(char *str, const char *sep, char **lasts);
+#ifdef HAVE_STRTOK_R
+#define tor_strok_r(str, sep, lasts) strtok_r(str, sep, lasts)
+#else
+#define tor_strok_r(str, sep, lasts) tor_strtok_r_impl(str, sep, lasts)
+#endif
+
#ifdef MS_WINDOWS
#define _SHORT_FILE_ (tor_fix_source_file(__FILE__))
const char *tor_fix_source_file(const char *fname);