summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-06-11 19:48:30 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2021-06-11 19:48:30 -0400
commit1cc6f587fb5ebb807d48ce3d67783b503fdb4723 (patch)
treed8b4da0b829f73c20be2a3591b7b03cb226dc4ba /config.c
parent27b25a10265724b6ab6af297653b72c5fb8754df (diff)
Replace call to `malloc()` with call to `calloc()` in
the config parser. Because `calloc()` zeros out the allocated space, we can remove the previous call to `memset()`.
Diffstat (limited to 'config.c')
-rw-r--r--config.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/config.c b/config.c
index f14e070..0454b8b 100644
--- a/config.c
+++ b/config.c
@@ -130,7 +130,7 @@ config *parse_config(const char *filename) {
return NULL;
}
- cfg = malloc(sizeof(config));
+ cfg = calloc(1, sizeof(config));
/* Return NULL, if cfg wasn't allocated. */
if (cfg == NULL) {
@@ -138,8 +138,6 @@ config *parse_config(const char *filename) {
return NULL;
}
- memset(cfg, 0, sizeof(config));
-
while (*tmp != '\0') {
char *line = get_line(&tmp);
char *value;