summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@iohq.net>2015-02-21 18:56:29 -0700
committerAaron Ball <nullspoon@iohq.net>2015-02-21 18:56:29 -0700
commit714d03c4f4e07fd9e90edd319c559169daa5e1cf (patch)
tree17c11e0692b38ff264e21554459c1ba5b1edaf59
parentcd6fdb269097a3f552d759b9a265049708c8f732 (diff)
downloadnoteless-714d03c4f4e07fd9e90edd319c559169daa5e1cf.tar.gz
noteless-714d03c4f4e07fd9e90edd319c559169daa5e1cf.tar.xz
Config change keys and values calloc to malloc
Malloc should use less compute power than calloc, plus calloc is unecessary in this case since we don't require the memory segement to be empty.
-rw-r--r--src/config.c4
-rw-r--r--src/config.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index 5e84338..a8c83d2 100644
--- a/src/config.c
+++ b/src/config.c
@@ -30,8 +30,8 @@ int config_new(config_t* conf, char* p) {
conf->count = config_valid_line_count(p);
- conf->keys = calloc(conf->count, sizeof(char*));
- conf->values = calloc(conf->count, sizeof(char*));
+ conf->keys = malloc(sizeof(char*) * conf->count);
+ conf->values = malloc(sizeof(char*) * conf->count);
FILE* f;
f = fopen(conf->path, "r");
diff --git a/src/config.h b/src/config.h
index 07af035..2a3e0d0 100644
--- a/src/config.h
+++ b/src/config.h
@@ -37,6 +37,7 @@ typedef struct config {
} config_t;
int config_new(config_t*, char*);
+
void config_free(config_t*);
int config_isset(config_t*, char*);

Generated by cgit