/*
- * A simple growing buffer
+ * UCW Library -- A simple growing buffer
*
* (c) 2004, Robert Spalek <robert@ucw.cz>
*
*
* GBUF_TYPE data type of records stored in the buffer
* GBUF_PREFIX(x) add a name prefix to all global symbols
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
*/
#include <stdlib.h>
static inline void
GBUF_PREFIX(grow)(BUF_T *b, uns len)
{
- if (len <= b->len)
+ if (likely(len <= b->len))
return;
if (len < 2*b->len) // to ensure logarithmic cost
len = 2*b->len;
#undef GBUF_TYPE
#undef GBUF_PREFIX
+#undef BUF_T