diff options
author | Rory Bradford <roryrjb@gmail.com> | 2020-08-10 16:14:07 +0100 |
---|---|---|
committer | Rory Bradford <roryrjb@gmail.com> | 2020-08-10 16:14:07 +0100 |
commit | dc4c58dee58d24d582d6d89cc29311652340e46a (patch) | |
tree | b7ed3dc6ad1e910c45a22f5c02417191e84fe4de | |
parent | b2f8846c34af5271941d7bddd65fd45fcba6b5a9 (diff) | |
download | rf-dc4c58dee58d24d582d6d89cc29311652340e46a.tar.gz |
Make calloc types explicit
Signed-off-by: Rory Bradford <roryrjb@gmail.com>
-rw-r--r-- | ignore.c | 9 | ||||
-rw-r--r-- | rf.c | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/ignore.c b/ignore.c index e5e324c..c247692 100644 --- a/ignore.c +++ b/ignore.c @@ -21,8 +21,9 @@ struct ignores *init_ignores(char *path) { char *line = NULL; size_t llen = 0; total_size = IGNORE_SIZE; - struct ignores *ignores = calloc(sizeof(struct ignores), 1); - ignores->list = calloc(sizeof(char *), IGNORE_SIZE); + struct ignores *ignores = + (struct ignores *)calloc(sizeof(struct ignores), 1); + ignores->list = (char **)calloc(sizeof(char *), IGNORE_SIZE); ignores->size = 0; while (getline(&line, &llen, ignore) != -1) { @@ -36,7 +37,7 @@ struct ignores *init_ignores(char *path) { } if (strlen(line) > 0) { - char *l = calloc(sizeof(char), strlen(line)); + char *l = (char *)calloc(sizeof(char), strlen(line)); if (l == NULL) { fprintf(stderr, "calloc\n"); @@ -54,7 +55,7 @@ struct ignores *init_ignores(char *path) { } if (i + 1 > total_size) { - ignores->list = realloc( + ignores->list = (char **)realloc( ignores->list, sizeof(char *) * (total_size + IGNORE_SIZE)); total_size += IGNORE_SIZE; } diff --git a/rf.c b/rf.c index 7510027..bee1ea9 100644 --- a/rf.c +++ b/rf.c @@ -241,7 +241,7 @@ int main(int argc, char **argv) { if (optind < argc) { int i = 0; int pattern_count = argc - optind; - char **patterns = calloc(sizeof(char *), pattern_count); + char **patterns = (char **)calloc(sizeof(char *), pattern_count); memset(patterns, '\0', optind); |