Re: [PATCH 2/2] posix_memalign: check for GNU behavior with size 0

2024-10-31 Thread Bruno Haible via Gnulib discussion list
Paul Eggert wrote: > + /* Use pposix_memalign to test; 'volatile' prevents the > compiler > + from optimizing the malloc call away. */ There's no malloc call here. > changequote(,)dnl > + # Guess no on AIX. > +aix*)gl_cv_func_ali

Re: [PATCH 2/2] posix_memalign: check for GNU behavior with size 0

2024-10-30 Thread Paul Eggert
On 2024-10-30 13:45, Jeffrey Walton wrote: I don't think ENOMEM is a good error for the condition. I guess you can't return EOVERFLOW or ERANGE? Maybe EINVAL would be better if that's the case. ENOMEM is more likely to do the right thing for the user in practice. Quite a bit of code tests for

Re: [PATCH 2/2] posix_memalign: check for GNU behavior with size 0

2024-10-30 Thread Jeffrey Walton
On Wed, Oct 30, 2024 at 3:51 PM Paul Eggert wrote: > > * lib/posix_memalign.c: Include stdckdint.h. > (posix_memalign): Test for overflow more straightforwardly, > and more portably to unlikely platforms where SIZE_MAX <= INT_MAX. > Treat a zero size as if it were alignment. > * m4/posix_memalign.

[PATCH 2/2] posix_memalign: check for GNU behavior with size 0

2024-10-30 Thread Paul Eggert
* lib/posix_memalign.c: Include stdckdint.h. (posix_memalign): Test for overflow more straightforwardly, and more portably to unlikely platforms where SIZE_MAX <= INT_MAX. Treat a zero size as if it were alignment. * m4/posix_memalign.m4 (gl_FUNC_POSIX_MEMALIGN): * tests/test-posix_memalign.c (main