Whamcloud - gitweb
LU-6142 libcfs: discard cfs_strrstr() 61/40861/2
authorMr NeilBrown <neilb@suse.de>
Tue, 24 Nov 2020 02:45:39 +0000 (13:45 +1100)
committerOleg Drokin <green@whamcloud.com>
Fri, 26 Feb 2021 22:10:58 +0000 (22:10 +0000)
commit3db4d9a69e4256a42a815e32f9f5c26a68e17454
tree0b8781bf972d842a489e356c6369004727f9ccd0
parentee5eb07d2f41ac603981c49cc7000f8938aefbeb
LU-6142 libcfs: discard cfs_strrstr()

cfs_strrstr() is only used in one place, and it can easily be open
coded there without increasing code complexity.  In particular the
fact that the "needle" cannot meaningfully be at the start of the
"haystack", means a simple loop does all we need.

In fact, there is room to improve the code in lwp_setup()
 - sprintf isn't needed as the result is a constant that can
   be calculated at compile time
 - adding the nul termination is then not needed as the buffer
   being copied to was initialised to zeroes.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I52b4abb36cf809d3bd9eebcc752959b0a81bfc13
Reviewed-on: https://review.whamcloud.com/40861
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_string.h
libcfs/libcfs/libcfs_string.c
lustre/osp/lwp_dev.c