From 850bc788c3fd4bb96f425ceedfe4237754cabe46 Mon Sep 17 00:00:00 2001 From: N-R-K <79544946+N-R-K@users.noreply.github.com> Date: Fri, 29 Oct 2021 02:00:53 +0600 Subject: code-style: general cleanups (#137) * tns_clean_cache: remove unused function arg * remove malloc casting * improve consistency use sizeof(T) at the end * avoid comparing integers of different signedness * use Window type for embed and parent * remove unnecessary comparisons * remove cpp style comments * improve consistency: remove comma from the end of enumerator list * Removed useless _IMAGE_CONFIG defines * consistency: use the same order as snprintf * Resolve c89 warnings Co-authored-by: uidops Co-authored-by: Arthur Williams --- thumbs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'thumbs.c') diff --git a/thumbs.c b/thumbs.c index 22d589f..f518ecb 100644 --- a/thumbs.c +++ b/thumbs.c @@ -49,7 +49,7 @@ char* tns_cache_filepath(const char *filepath) if (strncmp(filepath, cache_dir, strlen(cache_dir)) != 0) { /* don't cache images inside the cache directory! */ len = strlen(cache_dir) + strlen(filepath) + 2; - cfile = (char*) emalloc(len); + cfile = emalloc(len); snprintf(cfile, len, "%s/%s", cache_dir, filepath + 1); } return cfile; @@ -120,7 +120,7 @@ end: } } -void tns_clean_cache(tns_t *tns) +void tns_clean_cache(void) { int dirlen; char *cfile, *filename; @@ -150,7 +150,7 @@ void tns_init(tns_t *tns, fileinfo_t *files, const int *cnt, int *sel, win_t *wi const char *homedir, *dsuffix = ""; if (cnt != NULL && *cnt > 0) { - tns->thumbs = (thumb_t*) emalloc(*cnt * sizeof(thumb_t)); + tns->thumbs = emalloc(*cnt * sizeof(thumb_t)); memset(tns->thumbs, 0, *cnt * sizeof(thumb_t)); } else { tns->thumbs = NULL; @@ -174,7 +174,7 @@ void tns_init(tns_t *tns, fileinfo_t *files, const int *cnt, int *sel, win_t *wi const char *s = "/nsxiv"; free(cache_dir); len = strlen(homedir) + strlen(dsuffix) + strlen(s) + 1; - cache_dir = (char*) emalloc(len); + cache_dir = emalloc(len); snprintf(cache_dir, len, "%s%s%s", homedir, dsuffix, s); } else { error(0, 0, "Cache directory not found"); -- cgit v1.2.3-54-g00ecf