quagga: use AUTOBUFCHUNK as allocation unit
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 14 Apr 2016 20:11:42 +0000 (22:11 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 15 Apr 2016 09:59:49 +0000 (11:59 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/quagga/src/client.c
lib/quagga/src/client.h

index 6ef713f..cacaa93 100644 (file)
@@ -57,6 +57,7 @@
 #include "olsr.h"
 #include "log.h"
 #include "routing_table.h"
+#include "common/autobuf.h"
 
 #include "common.h"
 #include "quagga.h"
@@ -200,9 +201,9 @@ zclient_read(ssize_t * size)
     /* (re)allocate buffer */
     if (*size == bufsize) {
       ssize_t start = bufsize;
-      bufsize += BUFSIZE;
+      bufsize += AUTOBUFCHUNK;
       buf = my_realloc(buf, bufsize, "grow read buffer");
-      memset(&buf[start], 0, BUFSIZE);
+      memset(&buf[start], 0, AUTOBUFCHUNK);
     }
 
     /* read from socket */
index 1c4c004..b0679cb 100644 (file)
@@ -53,9 +53,6 @@
 
 #define STATUS_CONNECTED 1
 
-/* Buffer size */
-#define BUFSIZE 1024
-
 void zclient_reconnect(void);
 int zclient_write(unsigned char *);
 unsigned char *zclient_read(ssize_t *);