From a8b7c51a3a286eaa994c4ba0f0cfa8d3c1ed9ec8 Mon Sep 17 00:00:00 2001 From: _ <_> Date: Fri, 6 Apr 2018 14:46:17 -0700 Subject: [PATCH] Removed unneeded functions and libraries --- include/devil1pld.h | 10 +++------- src/devil1pld.c | 30 ------------------------------ 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/include/devil1pld.h b/include/devil1pld.h index b640184..93a006d 100644 --- a/include/devil1pld.h +++ b/include/devil1pld.h @@ -13,16 +13,12 @@ struct PldHeader { #pragma pack(pop) -// input: contents of the .pld file. -// allocates heap memory -//struct PldHeader *getpldh(const char*); - +// input: pointer to a struct, contents of the .pld file. +// * = pass by reference of a struct PldHeader bool getpldh(struct PldHeader*, const char*); -// frees heap memory -void destroypldh(struct PldHeader*); - // input: a pld header struct. +// * = pass by reference of a struct PldHeader void printpldh(struct PldHeader*); #endif \ No newline at end of file diff --git a/src/devil1pld.c b/src/devil1pld.c index 8d2bcff..1f55484 100644 --- a/src/devil1pld.c +++ b/src/devil1pld.c @@ -1,35 +1,5 @@ #include "devil1pld.h" #include -#include -#include - -/* struct PldHeader *getpldh(const char *filedata) { - if (filedata == NULL) { - return NULL; - } - int32_t *n = (int32_t*)filedata; - struct PldHeader *ph = (struct PldHeader*)malloc( - sizeof(struct PldHeader) - ); - uint32_t size_offsets = sizeof(uint32_t) * n[0]; - ph -> offsets = (uint32_t*)malloc(size_offsets); - if (ph -> offsets == NULL) { - perror("Error 4: "); - free(ph); - free(ph -> offsets); - return NULL; - } - // set data of struct. - ph -> numOffset = n[0]; - memcpy(ph -> offsets, filedata + sizeof(int32_t), size_offsets); - return ph; -} */ - -void destroypldh(struct PldHeader *ph) { - free(ph -> offsets); - free(ph); - ph = NULL; -} bool getpldh(struct PldHeader *ph, const char *filedata) { bool good = false;