diff src/dmgrowbuf.c @ 1694:e568535e1a96

Backed out changeset 9611ecd2c4fb
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 05 Jun 2018 11:03:17 +0300
parents ce8d4552ffd5
children 1036b0dcccb5
line wrap: on
line diff
--- a/src/dmgrowbuf.c	Tue Jun 05 09:52:53 2018 +0300
+++ b/src/dmgrowbuf.c	Tue Jun 05 11:03:17 2018 +0300
@@ -15,16 +15,29 @@
 #endif
 
 
-int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow)
+int dmGrowBufInit(DMGrowBuf *buf)
 {
-    DM_DBG("dmGrowBufAlloc(%p, %" DM_PRIu_SIZE_T ", %" DM_PRIu_SIZE_T ")\n",
-        buf, initial, mingrow);
+    DM_DBG("dmGrowBufInit(%p)\n", buf);
 
     if (buf == NULL)
         return DMERR_NULLPTR;
 
     memset(buf, 0, sizeof(DMGrowBuf));
 
+    return DMERR_OK;
+}
+
+
+int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow)
+{
+    int res;
+
+    DM_DBG("dmGrowBufAlloc(%p, %" DM_PRIu_SIZE_T ", %" DM_PRIu_SIZE_T ")\n",
+        buf, initial, mingrow);
+
+    if ((res = dmGrowBufInit(buf)) != DMERR_OK)
+        return res;
+
     buf->len  = 0;
     buf->offs = 0;
     buf->size = initial;