[PATCH 0/2] retire bcmp, a redundant wrapper around memcmp

Mateusz Guzik posted 2 patches 1 year, 2 months ago
arch/x86/boot/string.c       |  8 --------
arch/x86/boot/string.h       |  1 -
arch/x86/kernel/callthunks.c |  6 +++---
include/linux/string.h       |  3 ---
lib/Makefile                 |  3 +--
lib/string.c                 | 19 -------------------
6 files changed, 4 insertions(+), 36 deletions(-)
[PATCH 0/2] retire bcmp, a redundant wrapper around memcmp
Posted by Mateusz Guzik 1 year, 2 months ago
Reasoning copied from patch 2:
> While architectures could override it thanks to __HAVE_ARCH_BCMP, none
> of them did. Instead it was implemented as a call to memcmp().

> These routines differ in the API contract: memcmp()'s result indicates
> which way the difference goes (making it usable for sorting), whereas
> bcmp()'s result merely states whether the buffers differ in any way.

> This means that a dedicated optimized bcmp() is cheaper to execute than
> memcmp() for differing buffers as there is no need to compute the return
> value.

> However, per the above nobody bothered to write one and it is unclear if
> it makes sense to do it.

> Users which really want to compare stuff may want to handle it
> differently (like e.g., the path lookup).

Mateusz Guzik (2):
  x86/callthunks: s/bcmp/memcmp/
  string: retire bcmp()

 arch/x86/boot/string.c       |  8 --------
 arch/x86/boot/string.h       |  1 -
 arch/x86/kernel/callthunks.c |  6 +++---
 include/linux/string.h       |  3 ---
 lib/Makefile                 |  3 +--
 lib/string.c                 | 19 -------------------
 6 files changed, 4 insertions(+), 36 deletions(-)

-- 
2.43.0