aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-21 01:10:02 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-21 01:28:57 +0530
commit5301f78fa3ca01b9a425bd7c4757217d05c51207 (patch)
treed1b9eb0d20a7811c017ea310c029ed57653bb67a /src
parenta8544f284289e229826c993fccc1e232f647b560 (diff)
downloadnnn-5301f78fa3ca01b9a425bd7c4757217d05c51207.tar.gz
Optimized strcmp() macro
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 5ee09cc..bf4189d 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -214,6 +214,8 @@ disabledbg()
#define cleartimeout() timeout(-1)
#define errexit() printerr(__LINE__)
#define setdirwatch() (cfg.filtermode ? (presel = FILTER) : (dir_changed = TRUE))
+/* We don't care about the return value from strcmp() */
+#define xstrcmp(a, b) (*(a) != *(b) ? -1 : strcmp((a), (b)))
#ifdef LINUX_INOTIFY
#define EVENT_SIZE (sizeof(struct inotify_event))
@@ -2489,7 +2491,7 @@ static int dentfind(const char *fname, int n)
DPRINTF_S(fname);
for (i = 0; i < n; ++i)
- if (strcmp(fname, dents[i].name) == 0)
+ if (xstrcmp(fname, dents[i].name) == 0)
return i;
return 0;
@@ -3447,7 +3449,7 @@ nochange:
break;
/* Allow only relative, same dir paths */
- if (tmp[0] == '/' || strcmp(xbasename(tmp), tmp) != 0) {
+ if (tmp[0] == '/' || xstrcmp(xbasename(tmp), tmp) != 0) {
printmsg(messages[STR_INPUT_ID]);
goto nochange;
}