diff options
author | N-R-K <79544946+N-R-K@users.noreply.github.com> | 2021-10-28 22:00:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 22:00:53 +0200 |
commit | 850bc788c3fd4bb96f425ceedfe4237754cabe46 (patch) | |
tree | 8007a27013fe67601640e257310161a2c254f3ba /thumbs.c | |
parent | 03eb664e89d01cb9a28a9a2dcbad6aac208fa03b (diff) | |
download | nsxiv-850bc788c3fd4bb96f425ceedfe4237754cabe46.tar.zst |
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 <uidops@protonmail.com>
Co-authored-by: Arthur Williams <taaparthur@gmail.com>
Diffstat (limited to 'thumbs.c')
-rw-r--r-- | thumbs.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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"); |