[Swan-dev] replace type-safe min() with PMIN() in the realloc code

Andrew Cagney andrew.cagney at gmail.com
Wed Apr 17 23:51:51 UTC 2019


I

On Wed, 17 Apr 2019 at 17:27, D. Hugh Redelmeier <hugh at mimosa.com> wrote:
>
> | commit 94c2c3708a98ffde7cf0f14f35689c8a9816eed1
> | Author: Andrew Cagney <cagney at gnu.org>
> | Date:   Wed Apr 17 17:00:11 2019 -0400
> |
> |     libswan: replace type-safe min() with PMIN() in the realloc code
> |
> |     Don't assume that 'unsigned long' and size_t are type compatible.
> |
> |     Spotted by Tuomo.
>
> Why is union mhdr's i.size not of type size_t?

The code is old.
- perhaps size_t wasn't available or widely used
- perhaps the struct packed better
My hunch is 'void *end' would be a better replacement, I'm unlikely to try that.
Mumble something about uintptr_t ...

> Would making it so not be a cleaner change?

BTW, my assumption that size_t and long were different sizes is
probably wrong.  I'm not sure why the're not compatible, other than
the're not.

>From my pov it wasn't worth the fight :-)

> (I may well have been the one who created it in the first place.  If so,
> I don't remember why I didn't use size_t.)
> _______________________________________________
> Swan-dev mailing list
> Swan-dev at lists.libreswan.org
> https://lists.libreswan.org/mailman/listinfo/swan-dev


More information about the Swan-dev mailing list