From bf0e5690a31d4c3cecd2ba512729a0b73989bbda Mon Sep 17 00:00:00 2001 From: Oxore Date: Mon, 25 Jun 2018 15:50:58 +0300 Subject: Major refactoring Fix memleak in KeyMap, fix memleak caused by loading a yaml file in main.c. Change Copyright information. Rename functions.c and .h to engine.c and .h. Take field and shape related functions to separate file (still not all of them) and refactor them a lot. Refactor collision detection. Add more warnings. Add sanitizer option commented out. --- include/text.h | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 1171a51..73285bf 100644 --- a/include/text.h +++ b/include/text.h @@ -1,17 +1,39 @@ -FILE *openFile(char *filename); -void checkArgs(int argc, char **argv); +typedef struct List { + void *obj; + void *next; + void *prev; +} List; + +typedef struct Pair { + void *k; + void *v; +} Pair; + +typedef struct KeyMap { + Pair *pair; + void *next; + void *prev; +} KeyMap; + +typedef struct Text { + char *font; + char *type; + char *scene; + char *text; + void *sfText; +} Text; + +FILE *openFile(char *filename); +void checkArgs(int argc, char **argv); KeyMap *KeyMap_getLast(KeyMap **keyMap); KeyMap *KeyMap_new(KeyMap **keyMap); KeyMap *KeyMap_get(KeyMap **keyMap, const void *key); KeyMap *KeyMap_put(KeyMap **keyMap, const void *key, const void *value); -List *List_getLast(List **list); -List *List_new(List **list); -List *ListOfKeyMapOfString_getFromYaml(char *filename); -void KeyMapOfString_free(KeyMap *keyMap); -void ListOfKeyMapOfString_free(List **list); -int _loadText_getInt(void *obj, char *key); -char *_loadText_getString(void *obj, char *key); -void _loadText_initSfText(Text *objo, void *obji); -List *ListOfText_getFromListOfKeyMapOfString(List *list); -void Text_free(Text *obj); -void ListOfText_free(List **list); +List *List_getLast(List **list); +List *List_new(List **list); +List *ListOfKeyMapOfString_getFromYaml(char *filename); +void KeyMapOfString_free(KeyMap *keyMap); +void ListOfKeyMapOfString_free(List **list); +List *ListOfText_getFromListOfKeyMapOfString(List *list); +void Text_free(Text *obj); +void ListOfText_free(List **list); -- cgit v1.2.3