"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "include/common/buf.h" between
haproxy-1.9.3.tar.gz and haproxy-1.9.4.tar.gz

About: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.

buf.h  (haproxy-1.9.3):buf.h  (haproxy-1.9.4)
skipping to change at line 45 skipping to change at line 45
/* Structure defining a buffer's head */ /* Structure defining a buffer's head */
struct buffer { struct buffer {
size_t size; /* buffer size in bytes */ size_t size; /* buffer size in bytes */
char *area; /* points to <size> bytes */ char *area; /* points to <size> bytes */
size_t data; /* amount of data after head including wrappi ng */ size_t data; /* amount of data after head including wrappi ng */
size_t head; /* start offset of remaining data relative to area */ size_t head; /* start offset of remaining data relative to area */
}; };
/* A buffer may be in 3 different states : /* A buffer may be in 3 different states :
* - unallocated : size == 0, area == 0 (b_is_null() is true) * - unallocated : size == 0, area == 0 (b_is_null() is true)
* - waiting : size == 0, area != 0 * - waiting : size == 0, area != 0 (b_is_null() is true)
* - allocated : size > 0, area > 0 * - allocated : size > 0, area > 0 (b_is_null() is false)
*/ */
/* initializers for certain buffer states. It is important that the NULL buffer /* initializers for certain buffer states. It is important that the NULL buffer
* remains the one with all fields initialized to zero so that a calloc() or a * remains the one with all fields initialized to zero so that a calloc() or a
* memset() on a struct automatically sets a NULL buffer. * memset() on a struct automatically sets a NULL buffer.
*/ */
#define BUF_NULL ((struct buffer){ }) #define BUF_NULL ((struct buffer){ })
#define BUF_WANTED ((struct buffer){ .area = (char *)1 }) #define BUF_WANTED ((struct buffer){ .area = (char *)1 })
/***************************************************************************/ /***************************************************************************/
/* Functions used to compute offsets and pointers. Most of them exist in */ /* Functions used to compute offsets and pointers. Most of them exist in */
/* both wrapping-safe and unchecked ("__" prefix) variants. Some returning */ /* both wrapping-safe and unchecked ("__" prefix) variants. Some returning */
/* a pointer are also provided with an "_ofs" suffix when they return an */ /* a pointer are also provided with an "_ofs" suffix when they return an */
/* offset relative to the storage area. */ /* offset relative to the storage area. */
/***************************************************************************/ /***************************************************************************/
/* b_is_null() : returns true if (and only if) the buffer is not yet allocated /* b_is_null() : returns true if (and only if) the buffer is not yet allocated
* and thus points to a NULL area. * and thus has an empty size. Its pointer may then be anything, including NULL
* (unallocated) or an invalid pointer such as (char*)1 (allocation pending).
*/ */
static inline int b_is_null(const struct buffer *buf) static inline int b_is_null(const struct buffer *buf)
{ {
return buf->area == NULL; return buf->size == 0;
} }
/* b_orig() : returns the pointer to the origin of the storage, which is the /* b_orig() : returns the pointer to the origin of the storage, which is the
* location of byte at offset zero. This is mostly used by functions which * location of byte at offset zero. This is mostly used by functions which
* handle the wrapping by themselves. * handle the wrapping by themselves.
*/ */
static inline char *b_orig(const struct buffer *b) static inline char *b_orig(const struct buffer *b)
{ {
return b->area; return b->area;
} }
 End of changes. 3 change blocks. 
4 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)