use bzero() instead of memset_s()
authorDebian Samba Maintainers <pkg-samba-maint@lists.alioth.debian.org>
Wed, 2 Apr 2025 11:34:31 +0000 (14:34 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 2 Apr 2025 11:34:31 +0000 (14:34 +0300)
commit73cbe9f5fa18b86ea845d89f9c90af3524c95cd7
tree21d513ac92643905f1a5733cba031596f0a2f635
parent80921876214f051258f455dd96ee367ba84266ca
use bzero() instead of memset_s()

lib/replace/replace.h header defines ZERO_STRUCT macro
which uses memset_s() function (which is similar to
memset() but can not be optimized out by the compiler).
Glibc has bzero() with similar property, while memset_s()
have is implemented in lib/replace/replace.c, - this way,
some binaries needlessly link with libreplace-samba4 just
to get rep_memset_s() symbol. By using bzero() instead,
this endless linkage is eliminated, so we can package,
for example, libldb (which uses ZERO_STRUCT) without it
linking to libreplace-samba4.

Note: actually using explicit_bzero() so it is not optimized
out by the compiler - this is the original goal of using
memset_s().

Gbp-Pq: Name use-bzero-instead-of-memset_s.diff
lib/replace/replace.h