From dbf3435cde74a1300c991ce9e768fa0d235ad52a Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Wed, 25 Jun 2003 00:31:41 +0000 Subject: simplify fetch_from_buf; cull idle dnsworkers. svn:r354 --- src/or/buffers.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/or/buffers.c') diff --git a/src/or/buffers.c b/src/or/buffers.c index b179405284..010547f355 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); -- cgit v1.2.3-54-g00ecf