Added STREQ macro

master
Bert Münnich 2011-09-26 21:53:52 +02:00
parent d08408e942
commit d721d8453e
5 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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], "-");
}

View File

@ -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

2
util.c
View File

@ -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;

4
util.h
View File

@ -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)