# HG changeset patch # User Matti Hamalainen # Date 1588086719 -10800 # Node ID c64806412be0cc726c895aa9a3588f500fae3191 # Parent 87c8be2bc8ba2544deb5929e5d36ad2c3b5841e7 Cleanup. diff -r 87c8be2bc8ba -r c64806412be0 tools/packed.c --- 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; }