From a24081196ec68979eab49c1e35ce89066eb86d2f Mon Sep 17 00:00:00 2001 From: Dacav Date: Sat, 29 Aug 2020 08:01:46 +0200 Subject: clang-format --- filehash.c | 62 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'filehash.c') diff --git a/filehash.c b/filehash.c index 5616226..ace1992 100644 --- a/filehash.c +++ b/filehash.c @@ -1,53 +1,51 @@ #include "filehash.h" -#include #include +#include struct filehash_t { - const char *hash_program; - const char **argv; - unsigned max_per_invocation; + const char *hash_program; + const char **argv; + unsigned max_per_invocation; }; -filehash_t *filehash_new(const char *hash_program, unsigned max_per_invocation) +filehash_t * +filehash_new(const char *hash_program, unsigned max_per_invocation) { - filehash_t *fh; + filehash_t *fh; - fh = malloc(sizeof(filehash_t)); - if (!fh) - return NULL; + fh = malloc(sizeof(filehash_t)); + if (!fh) + return NULL; - *fh = (filehash_t){ - .hash_program = strdup(hash_program), - .max_per_invocation = max_per_invocation, - .argv = reallocarray( - NULL, - 1 + max_per_invocation, - sizeof(const char *) - ), - }; + *fh = (filehash_t){ + .hash_program = strdup(hash_program), + .max_per_invocation = max_per_invocation, + .argv = reallocarray(NULL, 1 + max_per_invocation, sizeof(const char *)), + }; - if (!fh->hash_program) - goto fail; - if (!fh->argv) - goto fail; + if (!fh->hash_program) + goto fail; + if (!fh->argv) + goto fail; - fh->argv[max_per_invocation] = NULL; + fh->argv[max_per_invocation] = NULL; - return fh; + return fh; fail: - filehash_free(fh); - return NULL; + filehash_free(fh); + return NULL; } -void filehash_free(filehash_t *fh) +void +filehash_free(filehash_t *fh) { - if (!fh) - return; + if (!fh) + return; - free(fh->argv); - free((void *)fh->hash_program); - free(fh); + free(fh->argv); + free((void *)fh->hash_program); + free(fh); } -- cgit 1.4.1-2-gfad0