changeset 2489:c64806412be0

Cleanup.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 28 Apr 2020 18:11:59 +0300
parents 87c8be2bc8ba
children 18ec4c092108
files tools/packed.c
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tools/packed.c	Tue Apr 28 18:09:32 2020 +0300
+++ b/tools/packed.c	Tue Apr 28 18:11:59 2020 +0300
@@ -260,23 +260,21 @@
 }
 
 
-int dmPackCreate(const char *filename, DMPackFile ** pack)
+int dmPackCreate(const char *filename, DMPackFile ** ppack)
 {
-    // Allocate packfile-structure
-    if ((*pack = (DMPackFile *) dmMalloc0(sizeof(DMPackFile))) == NULL)
+    DMPackFile *pack;
+
+    if ((pack = *ppack = (DMPackFile *) dmMalloc0(sizeof(DMPackFile))) == NULL)
         return DMERR_MALLOC;
 
-    // Open the file
-    (*pack)->file = fopen(filename, "wb");
-    if ((*pack)->file == NULL)
+    if ((pack->file = fopen(filename, "wb")) == NULL)
     {
-        dmFree(*pack);
+        dmFree(pack);
         return DMERR_FOPEN;
     }
 
-    (*pack)->filename = dm_strdup(filename);
+    pack->filename = dm_strdup(filename);
 
-    // Set the result
     return DMERR_OK;
 }