Skip to content

Commit 0cbf135

Browse files
authored
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 more efficient) to use strchr() instead of strstr(). Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: rilysh <[email protected]> Closes #15798
1 parent c3fd7a5 commit 0cbf135

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/libnvpair/libnvpair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ nvlist_prtctl_setfmt(nvlist_prtctl_t pctl, enum nvlist_prtctl_fmt which,
383383
pctl->nvprt_btwnarrfmt_nl = 0;
384384
} else {
385385
pctl->nvprt_btwnarrfmt = fmt;
386-
pctl->nvprt_btwnarrfmt_nl = (strstr(fmt, "\n") != NULL);
386+
pctl->nvprt_btwnarrfmt_nl = (strchr(fmt, '\n') != NULL);
387387
}
388388
break;
389389

0 commit comments

Comments
 (0)