nsxivd721d84
Added STREQ macro
+8 −6
5 files changed
| @@ -303,11 +303,11 @@ bool img_load(img_t *img, const fileinfo_t *file) { | |||
| 303 | 303 | (void) fmt; | |
| 304 | 304 | ||
| 305 | 305 | #if EXIF_SUPPORT | |
| 306 | − | if (!strcmp(fmt, "jpeg")) | |
| 306 | + | if (STREQ(fmt, "jpeg")) | |
| 307 | 307 | exif_auto_orientate(file); | |
| 308 | 308 | #endif | |
| 309 | 309 | #if GIF_SUPPORT | |
| 310 | − | if (!strcmp(fmt, "gif")) | |
| 310 | + | if (STREQ(fmt, "gif")) | |
| 311 | 311 | img_load_gif(img, file); | |
| 312 | 312 | #endif | |
| 313 | 313 | ||
| @@ -140,5 +140,5 @@ void parse_options(int argc, char **argv) { | |||
| 140 | 140 | _options.filenames = argv + optind; | |
| 141 | 141 | _options.filecnt = argc - optind; | |
| 142 | 142 | _options.from_stdin = _options.filecnt == 1 && | |
| 143 | − | !strcmp(_options.filenames[0], "-"); | |
| 143 | + | STREQ(_options.filenames[0], "-"); | |
| 144 | 144 | } | |
| @@ -255,7 +255,7 @@ bool tns_load(tns_t *tns, int n, const fileinfo_t *file, | |||
| 255 | 255 | (void) fmt; | |
| 256 | 256 | ||
| 257 | 257 | #if EXIF_SUPPORT | |
| 258 | − | if (!cache_hit && !strcmp(fmt, "jpeg")) | |
| 258 | + | if (!cache_hit && STREQ(fmt, "jpeg")) | |
| 259 | 259 | exif_auto_orientate(file); | |
| 260 | 260 | #endif | |
| 261 | 261 | ||
| @@ -270,7 +270,7 @@ char* r_readdir(r_dir_t *rdir) { | |||
| 270 | 270 | ||
| 271 | 271 | while (1) { | |
| 272 | 272 | if (rdir->dir && (dentry = readdir(rdir->dir))) { | |
| 273 | − | if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, "..")) | |
| 273 | + | if (STREQ(dentry->d_name, ".") || STREQ(dentry->d_name, "..")) | |
| 274 | 274 | continue; | |
| 275 | 275 | ||
| 276 | 276 | len = strlen(rdir->name) + strlen(dentry->d_name) + 2; | |
| @@ -30,7 +30,9 @@ | |||
| 30 | 30 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) | |
| 31 | 31 | #endif | |
| 32 | 32 | ||
| 33 | − | #define ARRLEN(a) (sizeof(a) / sizeof(a[0])) | |
| 33 | + | #define ARRLEN(a) (sizeof(a) / sizeof((a)[0])) | |
| 34 | + | ||
| 35 | + | #define STREQ(a,b) (!strcmp((a), (b))) | |
| 34 | 36 | ||
| 35 | 37 | #define TIMEDIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec) * 1000 + \ | |
| 36 | 38 | ((t1)->tv_usec - (t2)->tv_usec) / 1000) | |