aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--image.c4
-rw-r--r--options.c2
-rw-r--r--thumbs.c2
-rw-r--r--util.c2
-rw-r--r--util.h4
5 files changed, 8 insertions, 6 deletions
diff --git a/image.c b/image.c
index 9892e7a..9896a54 100644
--- a/image.c
+++ b/image.c
@@ -303,11 +303,11 @@ bool img_load(img_t *img, const fileinfo_t *file) {
(void) fmt;
#if EXIF_SUPPORT
- if (!strcmp(fmt, "jpeg"))
+ if (STREQ(fmt, "jpeg"))
exif_auto_orientate(file);
#endif
#if GIF_SUPPORT
- if (!strcmp(fmt, "gif"))
+ if (STREQ(fmt, "gif"))
img_load_gif(img, file);
#endif
diff --git a/options.c b/options.c
index 201b7cd..892c31f 100644
--- a/options.c
+++ b/options.c
@@ -140,5 +140,5 @@ void parse_options(int argc, char **argv) {
_options.filenames = argv + optind;
_options.filecnt = argc - optind;
_options.from_stdin = _options.filecnt == 1 &&
- !strcmp(_options.filenames[0], "-");
+ STREQ(_options.filenames[0], "-");
}
diff --git a/thumbs.c b/thumbs.c
index 11c580f..92fbd22 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -255,7 +255,7 @@ bool tns_load(tns_t *tns, int n, const fileinfo_t *file,
(void) fmt;
#if EXIF_SUPPORT
- if (!cache_hit && !strcmp(fmt, "jpeg"))
+ if (!cache_hit && STREQ(fmt, "jpeg"))
exif_auto_orientate(file);
#endif
diff --git a/util.c b/util.c
index 517e02b..de8dfae 100644
--- a/util.c
+++ b/util.c
@@ -270,7 +270,7 @@ char* r_readdir(r_dir_t *rdir) {
while (1) {
if (rdir->dir && (dentry = readdir(rdir->dir))) {
- if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, ".."))
+ if (STREQ(dentry->d_name, ".") || STREQ(dentry->d_name, ".."))
continue;
len = strlen(rdir->name) + strlen(dentry->d_name) + 2;
diff --git a/util.h b/util.h
index 8155613..68e534e 100644
--- a/util.h
+++ b/util.h
@@ -30,7 +30,9 @@
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
-#define ARRLEN(a) (sizeof(a) / sizeof(a[0]))
+#define ARRLEN(a) (sizeof(a) / sizeof((a)[0]))
+
+#define STREQ(a,b) (!strcmp((a), (b)))
#define TIMEDIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec) * 1000 + \
((t1)->tv_usec - (t2)->tv_usec) / 1000)