[MINOR] removed the ->h member in struct buffer

The buffer does not need the header pointer anymore, it has
been removed everywhere.
This commit is contained in:
Willy Tarreau 2007-03-18 16:31:29 +01:00
parent b49871738e
commit e09e0cef62
4 changed files with 12 additions and 14 deletions

View File

@ -2,7 +2,7 @@
include/proto/buffers.h
Buffer management definitions, macros and inline functions.
Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu
Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -34,7 +34,7 @@
static inline void buffer_init(struct buffer *buf)
{
buf->l = buf->total = buf->flags = 0;
buf->rlim = buf->h = buf->r = buf->lr = buf->w = buf->data;
buf->rlim = buf->r = buf->lr = buf->w = buf->data;
}
/* returns 1 if the buffer is empty, 0 otherwise */
@ -51,7 +51,7 @@ static inline int buffer_isfull(const struct buffer *buf) {
/* flushes any content from buffer <buf> */
static inline void buffer_flush(struct buffer *buf)
{
buf->r = buf->h = buf->lr = buf->w = buf->data;
buf->r = buf->lr = buf->w = buf->data;
buf->l = 0;
}
@ -76,7 +76,7 @@ static inline int buffer_realign(struct buffer *buf)
{
if (buf->l == 0) {
/* let's realign the buffer to optimize I/O */
buf->r = buf->w = buf->h = buf->lr = buf->data;
buf->r = buf->w = buf->lr = buf->data;
}
return buffer_max(buf);
}

View File

@ -2,7 +2,7 @@
include/types/buffers.h
Buffer management definitions, macros and inline functions.
Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu
Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -67,7 +67,7 @@ struct buffer {
int wto; /* write timeout */
int cto; /* connect timeout */
unsigned int l; /* data length */
char *r, *w, *h, *lr; /* read ptr, write ptr, last header ptr, last read */
char *r, *w, *lr; /* read ptr, write ptr, last read */
char *rlim; /* read limit, used for header rewriting */
unsigned long long total; /* total data read */
char data[BUFSIZE];

View File

@ -1,7 +1,7 @@
/*
* Buffer management functions.
*
* Copyright 2000-2006 Willy Tarreau <w@1wt.eu>
* Copyright 2000-2007 Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -95,7 +95,6 @@ int buffer_replace(struct buffer *b, char *pos, char *end, char *str)
/* we only move data after the displaced zone */
if (b->r > pos) b->r += delta;
if (b->w > pos) b->w += delta;
if (b->h > pos) b->h += delta;
if (b->lr > pos) b->lr += delta;
b->l += delta;
@ -131,7 +130,6 @@ int buffer_replace2(struct buffer *b, char *pos, char *end, char *str, int len)
/* we only move data after the displaced zone */
if (b->r > pos) b->r += delta;
if (b->w > pos) b->w += delta;
if (b->h > pos) b->h += delta;
if (b->lr > pos) b->lr += delta;
b->l += delta;
@ -160,8 +158,8 @@ int chunk_printf(struct chunk *chk, int size, const char *fmt, ...)
void buffer_dump(FILE *o, struct buffer *b, int from, int to)
{
fprintf(o, "Dumping buffer %p\n", b);
fprintf(o, " data=%p l=%d r=%p w=%p h=%p lr=%p\n",
b->data, b->l, b->r, b->w, b->h, b->lr);
fprintf(o, " data=%p l=%d r=%p w=%p lr=%p\n",
b->data, b->l, b->r, b->w, b->lr);
if (!to || to > b->l)
to = b->l;

View File

@ -1,7 +1,7 @@
/*
* Functions operating on SOCK_STREAM and buffers.
*
* Copyright 2000-2006 Willy Tarreau <w@1wt.eu>
* Copyright 2000-2007 Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -60,7 +60,7 @@ int stream_sock_read(int fd) {
#endif
{
if (b->l == 0) { /* let's realign the buffer to optimize I/O */
b->r = b->w = b->h = b->lr = b->data;
b->r = b->w = b->lr = b->data;
max = b->rlim - b->data;
}
else if (b->r > b->w) {
@ -156,7 +156,7 @@ int stream_sock_write(int fd) {
#endif
if (b->l == 0) { /* let's realign the buffer to optimize I/O */
b->r = b->w = b->h = b->lr = b->data;
b->r = b->w = b->lr = b->data;
max = 0;
}
else if (b->r > b->w) {