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 <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: rilysh <nightquick@proton.me> Closes #15798
This commit is contained in:
parent
c3fd7a5217
commit
0cbf135293
|
@ -383,7 +383,7 @@ nvlist_prtctl_setfmt(nvlist_prtctl_t pctl, enum nvlist_prtctl_fmt which,
|
||||||
pctl->nvprt_btwnarrfmt_nl = 0;
|
pctl->nvprt_btwnarrfmt_nl = 0;
|
||||||
} else {
|
} else {
|
||||||
pctl->nvprt_btwnarrfmt = fmt;
|
pctl->nvprt_btwnarrfmt = fmt;
|
||||||
pctl->nvprt_btwnarrfmt_nl = (strstr(fmt, "\n") != NULL);
|
pctl->nvprt_btwnarrfmt_nl = (strchr(fmt, '\n') != NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue