diff options
author | Oxore <oxore@protonmail.com> | 2018-06-25 15:50:58 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2018-06-25 15:50:58 +0300 |
commit | bf0e5690a31d4c3cecd2ba512729a0b73989bbda (patch) | |
tree | 5b95c5a52c8a9025593231ee0285d81d40890f0f /src/text.c | |
parent | 63e929f7a23b44ff2b1e33ccf16307de20c2bdc8 (diff) |
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.
Diffstat (limited to 'src/text.c')
-rw-r--r-- | src/text.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -77,7 +77,6 @@ KeyMap *KeyMap_put(KeyMap **keyMap, const void *key, const void *value) KeyMap *keyMapLocal = KeyMap_get(keyMap, key); if (!keyMapLocal) { keyMapLocal = KeyMap_new(keyMap); - keyMapLocal->pair = malloc(sizeof(Pair)); keyMapLocal->pair->k = malloc(strlen(key)+1); strcpy(keyMapLocal->pair->k, key); } @@ -180,7 +179,7 @@ void ListOfKeyMapOfString_free(List **list) *list = 0; } -int _loadText_getInt(void *obj, char *key) +static int _loadText_getInt(void *obj, char *key) { int v = 0; KeyMap *keyMap = KeyMap_get((KeyMap **)&obj, key); @@ -191,7 +190,7 @@ int _loadText_getInt(void *obj, char *key) return v; } -char *_loadText_getString(void *obj, char *key) +static char *_loadText_getString(void *obj, char *key) { char *v = 0; KeyMap *keyMap = KeyMap_get((KeyMap **)&obj, key); @@ -204,10 +203,10 @@ char *_loadText_getString(void *obj, char *key) return v; } -void _loadText_initSfText(Text *objo, void *obji) +static void _loadText_initSfText(Text *objo, void *obji) { sfVector2f pos = { - .x = _loadText_getInt(obji, "x"), + .x = _loadText_getInt(obji, "x"), .y = _loadText_getInt(obji, "y") }; int size = _loadText_getInt(obji, "size"); |