diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-02-14 19:10:20 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-02-14 19:10:20 -0500 |
commit | 7e469c10020f92b6aa19cb3f4316fb040d837819 (patch) | |
tree | ce6a0f2f2fb22c78ed09a1ed838d13f7967c92e6 /src/common | |
parent | dca8ae5cfa8b081230d033158c980d50840b072a (diff) | |
parent | 4c1ecd75830cbf43bc39b9c77ee01b3ce138e40c (diff) | |
download | tor-7e469c10020f92b6aa19cb3f4316fb040d837819.tar.gz tor-7e469c10020f92b6aa19cb3f4316fb040d837819.zip |
Merge branch 'bug20894_029_v3'
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.c | 13 | ||||
-rw-r--r-- | src/common/util.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c index 180712ad6d..f980fa296c 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -704,6 +704,19 @@ tor_strisnonupper(const char *s) return 1; } +/** Return true iff every character in <b>s</b> is whitespace space; else + * return false. */ +int +tor_strisspace(const char *s) +{ + while (*s) { + if (!TOR_ISSPACE(*s)) + return 0; + s++; + } + return 1; +} + /** As strcmp, except that either string may be NULL. The NULL string is * considered to be before any non-NULL string. */ int diff --git a/src/common/util.h b/src/common/util.h index ff566151cb..13fcc5142d 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -186,6 +186,7 @@ void tor_strlower(char *s) ATTR_NONNULL((1)); void tor_strupper(char *s) ATTR_NONNULL((1)); int tor_strisprint(const char *s) ATTR_NONNULL((1)); int tor_strisnonupper(const char *s) ATTR_NONNULL((1)); +int tor_strisspace(const char *s); int strcmp_opt(const char *s1, const char *s2); int strcmpstart(const char *s1, const char *s2) ATTR_NONNULL((1,2)); int strcmp_len(const char *s1, const char *s2, size_t len) ATTR_NONNULL((1,2)); |