* please see the file GPL in the top level source directory.
*/
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
+#include "lib-lib.h"
-#include "mem.h"
-#include "str.h"
-#include "ascii.h"
-#include "buffer.h"
-#include "file.h"
+#define BUFSIZ_INCREMENT 1024
+
+void buffer_resize(buffer_t *buf, ssize_t newsize)
+{
+ if (newsize >= buf->size) {
+ /* rounds newsize to the 1024 multiple just after newsize+1 */
+ newsize = (newsize + BUFSIZ_INCREMENT) & ~(BUFSIZ_INCREMENT - 1);
+ p_realloc(&buf->data, newsize);
+ }
+}
+
+
+
+
+/****** LEGACY BUFFERS *******/
/*
* Creates and initializes a BUFFER*. If passed an existing BUFFER*,