diff options
Diffstat (limited to 'common/buffer.c')
-rw-r--r-- | common/buffer.c | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/common/buffer.c b/common/buffer.c index 1ca4c6b..92d0519 100644 --- a/common/buffer.c +++ b/common/buffer.c @@ -29,11 +29,6 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. - * - * - * CONTRIBUTORS - * Nate Nielsen <nielsen@memberwebs.com> - * */ #include "compat.h" @@ -79,13 +74,13 @@ internal_t; #ifdef BUF_DEBUG void buffer_dump(ha_buffer_t* buf) { - internal_t* itl; - int i = 0; + internal_t* itl; + int i = 0; - fprintf(stderr, "Buffer DUMP ---------------------------\n"); + fprintf(stderr, "Buffer DUMP ---------------------------\n"); for(itl = buf->_ft; itl; itl = itl->next, i++) - fprintf(stderr, "itl %d: 0x%08X bytes\n", i, itl->end - (char*)itl); - fprintf(stderr, "---------------------------------------\n"); + fprintf(stderr, "itl %d: 0x%08X bytes\n", i, itl->end - (char*)itl); + fprintf(stderr, "---------------------------------------\n"); } #endif /* BUF_DEBUG */ @@ -100,7 +95,7 @@ void buffer_bump(ha_buffer_t* buf, int count) return; ASSERT(BUF_DELTA < BUF_INITIAL); - ASSERT(buf->_dt->next == NULL); + ASSERT(buf->_dt->next == NULL); /* Handle this common case first for efficiency */ if(buf->_rp + (count + BUF_DELTA) < buf->_dt->end) @@ -111,7 +106,7 @@ void buffer_bump(ha_buffer_t* buf, int count) return; #ifdef BUF_DEBUG - buffer_dump (buf); + buffer_dump (buf); #endif /* Okay now we know we have to extend */ @@ -185,43 +180,43 @@ void ha_bufinit(ha_buffer_t* buf) FILL_BETWEEN(INTERNAL_DATA(buf->_ft), buf->_ft->end, 0xCD); #endif - buf->_dt = buf->_ft; - ha_bufreset(buf); - } + buf->_dt = buf->_ft; + ha_bufreset(buf); + } } void ha_bufreset(ha_buffer_t* buf) { - internal_t* itl; - internal_t* next; + internal_t* itl; + internal_t* next; ASSERT(buf); ASSERT(buf->_ft); - if(ha_buferr(buf)) - return; + if(ha_buferr(buf)) + return; - /* We keep the last buffer, and free the rest */ - itl = buf->_ft; - buf->_ft = buf->_dt; + /* We keep the last buffer, and free the rest */ + itl = buf->_ft; + buf->_ft = buf->_dt; buf->_rp = buf->_pp = (char*)INTERNAL_DATA(buf->_ft); #ifdef BUF_DEBUG - fprintf(stderr, "RESET BUFFER: %d\n", buf->_ft->end - (char*)buf->_ft); + fprintf(stderr, "RESET BUFFER: %d\n", buf->_ft->end - (char*)buf->_ft); #endif - for( ; itl != buf->_ft; itl = next) - { - ASSERT(itl != NULL); - next = itl->next; + for( ; itl != buf->_ft; itl = next) + { + ASSERT(itl != NULL); + next = itl->next; #ifdef _DEBUG - FILL_BETWEEN(INTERNAL_DATA(itl), itl->end, 0xDD); + FILL_BETWEEN(INTERNAL_DATA(itl), itl->end, 0xDD); #endif #ifdef BUF_DEBUG - fprintf(stderr, "FREEING: %d\n", itl->end - (char*)itl); + fprintf(stderr, "FREEING: %d\n", itl->end - (char*)itl); #endif free(itl); - } + } #ifdef _DEBUG FILL_BETWEEN(INTERNAL_DATA(buf->_ft), buf->_ft->end, 0xCD); |