[Bug] 1361811cb botches unused macro

Achim Gratz Stromeko at nexgo.de
Mon Feb 20 18:38:52 UTC 2017


Gary E. Miller writes:
> I am unclear which macro you are referring to?  I thought were you talking
> about REFIDLEN, that is used a lot.

The patch inadvertently removed the continuation line from
LEN_CRYPTO_TO_ZERO, which makes the macro define an incomplete
expression.  I'm not sure how that could have been unclear if you've
actually looked at the offending commit or the patch section I've copied
into my post.

> Can you be specific on which macros you think can be removed?
>
> I think you mean these three?
>
> spidey ntpsec # fgrep CRYPTO_TO_ * -r

You might be elated to know that "git grep" exists and does that search
in a much better way.

> include/ntp.h:#define CRYPTO_TO_ZERO(p)	((char *)&((p)->clear_to_zero))
> include/ntp.h:#define END_CRYPTO_TO_ZERO(p)	((char *)&((p)->end_clear_to_zero))
> include/ntp.h:#define LEN_CRYPTO_TO_ZERO	(END_CRYPTO_TO_ZERO((struct peer *)0) \

Yes.  The three macros above these are used exactly once: the first two
in the definition of the third and the third macro in one memset.  If
the peer structure was defined a bit differently so that the ephemeral
data was encapsulated in its own type, it should be possible to use the
sizeof operator there instead of pointer arithmetic, which seems more
appropriate.  I'll note in passing that the comment announcing the end
of the ephemeral section seems to be in the wrong place as the outcount
member below it will be zeroed as well.

> If you canfirm I'll remove them.

Go ahead and nuke them.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds



More information about the devel mailing list