From 291d98ee5036567f93d21bc11142b0a7e2ee70ae Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 12 Jun 2018 00:00:00 -0500 Subject: [PATCH] top: make rcfile duplicate fields check more efficient Jeeze, there was no need to employ *both* strchr() and strrchr() when ensuring fields hadn't been duplicated. So let's avoid one of those function calls completely. Signed-off-by: Jim Warner --- top/top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/top/top.c b/top/top.c index f4898de9..3681758f 100644 --- a/top/top.c +++ b/top/top.c @@ -3742,7 +3742,7 @@ static const char *config_file (FILE *fp, const char *name, float *delay) { #endif // ensure there's been no manual alteration of fieldscur for (n = 0 ; n < EU_MAXPFLGS; n++) { - if (strchr(w->rc.fieldscur, w->rc.fieldscur[n]) != strrchr(w->rc.fieldscur, w->rc.fieldscur[n])) + if (&w->rc.fieldscur[n] != strrchr(w->rc.fieldscur, w->rc.fieldscur[n])) return p; } // be tolerant of missing release 3.3.10 graph modes additions -- 2.40.0