aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-06-25 01:51:22 +0200
committerLouis Burda <quent.burda@gmail.com>2021-06-25 01:51:35 +0200
commitc7c6f38c144142563e135eceb5daed492c203a85 (patch)
tree8c041825d524bc44048cd237335bc569c7ff939d /src/util.h
parent14bc8a3883663656cd4254567a978002c062992d (diff)
downloadenowars5-service-stldoctor-c7c6f38c144142563e135eceb5daed492c203a85.tar.gz
enowars5-service-stldoctor-c7c6f38c144142563e135eceb5daed492c203a85.zip
fix free() of potentially uninitialized pointer and minor refactors in service
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util.h b/src/util.h
index 32555ce..73346a3 100644
--- a/src/util.h
+++ b/src/util.h
@@ -11,10 +11,12 @@
#define MIN(x,y) ((x) > (y) ? (y) : (x))
#define MAX(x,y) ((x) < (y) ? (y) : (x))
+#define PRINTABLE(c) ((c) >= 32 ? (c) : ' ')
+
#define ERR(...) fprintf(stderr, "ERR: " __VA_ARGS__)
-#define NFREE(p) do { free(p); p = NULL; } while (0)
-#define NFCLOSE(f) do { fclose(f); f = NULL; } while (0)
+#define FREE(p) do { free(p); p = NULL; } while (0)
+#define FCLOSE(f) do { if (f) fclose(f); f = NULL; } while (0)
#define MHASHLEN 40