#3941 Remove macro ZERO_STRUCT
Merged by jhrozek. Opened by lslebodn.
SSSD/ lslebodn/sssd zero_struct  into  master

Download 3941.patch

It was used just on few places and we directly call memset on many
other places

[~/sssd]$ git grep memset | grep sizeof | wc -l
97

It is not possible to compile sssd on rawhide because samba made such macros public
and it is used in ndr.h

https://bugzilla.redhat.com/show_bug.cgi?id=1671507

OK, it seems odd to export a non-namespaced macro in a public header, but then we can't use this macro either. IIRC our copy of ZERO_STRUCT came from Samba anyway.

btw do you know, from a C perspective, why the ZERO_STRUCT macro would cast the pointer to char?

anyway, LGTM, will run the commit through CI.

OK, it seems odd to export a non-namespaced macro in a public header, but then we can't use this macro either. IIRC our copy of ZERO_STRUCT came from Samba anyway.

But they "recently" changed definition from memset -> memset_s

btw do you know, from a C perspective, why the ZERO_STRUCT macro would cast the pointer to char?

The function memset expect void * and IIRC you can pass any pointer there.
You would need to probably ask original authors :-)

My guessing would be that they wanted to use the macro for const struct ....
Which is far from ideal use-case IMHO.

anyway, LGTM, will run the commit through CI.

Commit 7133c7fc fixes this pull-request

Pull-Request has been merged by jhrozek

Metadata