diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | compressor.c | 9 | ||||
| -rw-r--r-- | util.c | 11 | ||||
| -rw-r--r-- | util.h | 2 |
4 files changed, 14 insertions, 10 deletions
@@ -1,7 +1,7 @@ CFLAGS = -std=c99 -I ./ -Wall -Wextra -pedantic -Wno-deprecated-declarations -D_XOPEN_SOURCE=700L LDFLAGS = -lSDL2 -lSDL2_ttf -lm -SRC = main.c microui.c renderer.c widget.c ui.c unit.c engine.c compressor.c eprintf.c cwalk.c toml.c +SRC = main.c microui.c renderer.c widget.c ui.c unit.c engine.c compressor.c eprintf.c cwalk.c toml.c util.c OBJ = ${SRC:.c=.o} HDR = microui.h renderer.h widget.h ui.h unit.h engine.h eprintf.h util.h cwalk.h toml.h diff --git a/compressor.c b/compressor.c index bca4210..358849b 100644 --- a/compressor.c +++ b/compressor.c @@ -26,7 +26,6 @@ static int parse_volume_flow(double val, const char *unit, Flow *flow); static int lsearch(const void *key, const void *base, size_t n, size_t size, int (*cmp)(const void *keyval, const void *datum)); static int toml_filter(const struct dirent *de); static int cmp_flow_unit(const void *key, const void *datum); -static void free_arr(void **arr, int n); /* Load descriptions of all of the compressor maps. @@ -269,11 +268,3 @@ toml_filter(const struct dirent *de) { } return strcmp(".toml", extension) == 0; /* extension is ".toml". */ } - -static void -free_arr(void **arr, int n) { - while (n-- > 0) { - free(arr[n]); - } - free(arr); -} @@ -0,0 +1,11 @@ +#include <stdlib.h> + +#include "util.h" + +void +free_arr(void **arr, int n) { + while (n-- > 0) { + free(arr[n]); + } + free(arr); +} @@ -1,3 +1,5 @@ #define nelem(arr) (sizeof(arr)/sizeof(arr[0])) #define min(a, b) ((a < b) ? a : b) #define max(a, b) ((a > b) ? a : b) + +void free_arr(void **arr, int n); |