summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-07-10 20:08:18 +0000
committerNick Mathewson <nickm@torproject.org>2007-07-10 20:08:18 +0000
commit7e20fdbefb5f1ecad8fcb4b4876c937dc55d1615 (patch)
tree342979c5f6aa570128de4ed972becd8fae064e20 /src/common/util.c
parentd6ba1c3d960d943dcded1d108f1b1c4bd15b0add (diff)
downloadtor-7e20fdbefb5f1ecad8fcb4b4876c937dc55d1615.tar.gz
tor-7e20fdbefb5f1ecad8fcb4b4876c937dc55d1615.zip
r13687@catbus: nickm | 2007-07-10 16:08:14 -0400
Possible partial fix for bug 455: use eos logic everywhere. svn:r10786
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 4c9370945d..cfc06d4208 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -505,6 +505,15 @@ eat_whitespace_no_nl(const char *s)
return s;
}
+/** DOCDOC */
+const char *
+eat_whitespace_eos_no_nl(const char *s, const char *eos)
+{
+ while (s < eos && (*s == ' ' || *s == '\t'))
+ ++s;
+ return s;
+}
+
/** Return a pointer to the first char of s that is whitespace or <b>#</b>,
* or to the terminating NUL if no such character exists.
*/
@@ -528,6 +537,29 @@ find_whitespace(const char *s)
}
}
+/** DOCDOC */
+const char *
+find_whitespace_eos(const char *s, const char *eos)
+{
+ /* tor_assert(s); */
+ while (s < eos) {
+ switch (*s)
+ {
+ case '\0':
+ case '#':
+ case ' ':
+ case '\r':
+ case '\n':
+ case '\t':
+ return s;
+ default:
+ ++s;
+ }
+ }
+ return NULL;
+}
+
+
/** Return true iff the 'len' bytes at 'mem' are all zero. */
int
tor_mem_is_zero(const char *mem, size_t len)