changeset 1692:9611ecd2c4fb

Get rid of dmGrowBufInit().
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 05 Jun 2018 09:50:08 +0300
parents e68f7b0cb536
children ce8d4552ffd5
files src/dmgrowbuf.c src/dmgrowbuf.h tools/gfxconv.c
diffstat 3 files changed, 3 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/dmgrowbuf.c	Tue Jun 05 09:37:37 2018 +0300
+++ b/src/dmgrowbuf.c	Tue Jun 05 09:50:08 2018 +0300
@@ -15,29 +15,16 @@
 #endif
 
 
-int dmGrowBufInit(DMGrowBuf *buf)
+int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow)
 {
-    DM_DBG("dmGrowBufInit(%p)\n", buf);
+    DM_DBG("dmGrowBufAlloc(%p, %" DM_PRIu_SIZE_T ", %" DM_PRIu_SIZE_T ")\n",
+        buf, initial, mingrow);
 
     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;
--- a/src/dmgrowbuf.h	Tue Jun 05 09:37:37 2018 +0300
+++ b/src/dmgrowbuf.h	Tue Jun 05 09:50:08 2018 +0300
@@ -25,7 +25,6 @@
 } DMGrowBuf;
 
 
-int    dmGrowBufInit(DMGrowBuf *buf);
 int    dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow);
 int    dmGrowBufNew(DMGrowBuf **pbuf, const size_t initial, const size_t mingrow);
 void   dmGrowBufFree(DMGrowBuf *buf);
--- a/tools/gfxconv.c	Tue Jun 05 09:37:37 2018 +0300
+++ b/tools/gfxconv.c	Tue Jun 05 09:50:08 2018 +0300
@@ -1058,8 +1058,6 @@
     int res = DMERR_OK;
     DMGrowBuf buf;
 
-    dmGrowBufInit(&buf);
-
     // Encode to target format
     dmMsg(1, "Encoding C64 bitmap data to format '%s'\n", fmt->name);
     if ((res = dmC64EncodeBMP(&buf, image, fmt)) != DMERR_OK)