summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-02-06 16:58:05 +0000
committerNick Mathewson <nickm@torproject.org>2008-02-06 16:58:05 +0000
commita869574c564440c79a40b0d2019ad0a6c8b24174 (patch)
tree01d744a063b377e049f87c17ad4c567905db9bdd /src/common/util.c
parentf76cdc1a611fdbc134cabd1e0d81e7d9d8fd3648 (diff)
downloadtor-a869574c564440c79a40b0d2019ad0a6c8b24174.tar.gz
tor-a869574c564440c79a40b0d2019ad0a6c8b24174.zip
r17947@catbus: nickm | 2008-02-06 11:57:53 -0500
Fix a bunch of DOCDOC items; document the --quiet flag; refactor a couple of XXXX020 items. svn:r13405
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 21ac808786..2169fbbb6c 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1298,7 +1298,10 @@ parse_http_time(const char *date, struct tm *tm)
return 0;
}
-/** DOCDOC */
+/** Given an <b>interval</b> in seconds, try to write it to the
+ * <b>out_len</b>-byte buffer in <b>out</b> in a human-readable form.
+ * Return 0 on success, -1 on failure.
+ */
int
format_time_interval(char *out, size_t out_len, long interval)
{
@@ -1932,13 +1935,19 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
#define TOR_ISODIGIT(c) ('0' <= (c) && (c) <= '7')
-/* DOCDOC */
+/* Given a c-style double-quoted escaped string in <b>s</b>, extract and
+ * decode its contents into a newly allocated string. On success, assign this
+ * string to *<b>result</b>, assign its length to <b>size_out</b> (if
+ * provided), and return a pointer to the position in <b>s</b> immediately
+ * after the string. On failure, return NULL.
+ */
static const char *
unescape_string(const char *s, char **result, size_t *size_out)
{
const char *cp;
char *out;
- tor_assert(s[0] == '\"');
+ if (s[0] != '\"')
+ return NULL;
cp = s+1;
while (1) {
switch (*cp) {