aboutsummaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-06-25 00:31:41 +0000
committerRoger Dingledine <arma@torproject.org>2003-06-25 00:31:41 +0000
commitdbf3435cde74a1300c991ce9e768fa0d235ad52a (patch)
treed84dad5c296e6e85bac8985eb183e09f8a1648e0 /src/or/buffers.c
parentad917e77882bae5f1dbefae90d231bf0392fc884 (diff)
downloadtor-dbf3435cde74a1300c991ce9e768fa0d235ad52a.tar
tor-dbf3435cde74a1300c991ce9e768fa0d235ad52a.tar.gz
simplify fetch_from_buf; cull idle dnsworkers.
svn:r354
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index b17940528..010547f35 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -135,20 +135,14 @@ int write_to_buf(char *string, int string_len,
int fetch_from_buf(char *string, int string_len,
char **buf, int *buflen, int *buf_datalen) {
- /* if there are string_len bytes in buf, write them onto string,
+ /* There must be string_len bytes in buf; write them onto string,
* then memmove buf back (that is, remove them from buf).
*
- * If there are not enough bytes on the buffer to fill string, return -1.
- *
* Return the number of bytes still on the buffer. */
assert(string && buf && *buf && buflen && buf_datalen);
+ assert(string_len <= *buf_datalen); /* make sure we don't ask for too much */
- /* this is the point where you would grow the buffer, if you want to */
-
- if(string_len > *buf_datalen) /* we want too much. sorry. */
- return -1;
-
memcpy(string,*buf,string_len);
*buf_datalen -= string_len;
memmove(*buf, *buf+string_len, *buf_datalen);