From 398d9c58226dda8a852a006b39ebfc51a0624c1c Mon Sep 17 00:00:00 2001 From: rilysh Date: Sun, 21 Jan 2024 12:48:25 +0530 Subject: [PATCH] libnvpair.c: replace strstr() with strchr() for a single character Since we're looking for a single new-line character in the haystack, it's better (and slightly efficient) to use strchr() instead of strstr(). Signed-off-by: rilysh --- lib/libnvpair/libnvpair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libnvpair/libnvpair.c b/lib/libnvpair/libnvpair.c index f19ee707a5aa..7141c437b810 100644 --- a/lib/libnvpair/libnvpair.c +++ b/lib/libnvpair/libnvpair.c @@ -383,7 +383,7 @@ nvlist_prtctl_setfmt(nvlist_prtctl_t pctl, enum nvlist_prtctl_fmt which, pctl->nvprt_btwnarrfmt_nl = 0; } else { pctl->nvprt_btwnarrfmt = fmt; - pctl->nvprt_btwnarrfmt_nl = (strstr(fmt, "\n") != NULL); + pctl->nvprt_btwnarrfmt_nl = (strchr(fmt, '\n') != NULL); } break;