Re: dnscurve updates

Simon Casady <[email protected]>
Newsgroups gmane.network.djbdns
Message-ID <[email protected]>
The standard C malloc is supposed to return a pointer to memory
suitably aligned for anything. What else is needed ?


On 1/7/10, David Nicol <[email protected]> wrote:
> after looking at
> http://www.opengroup.org/onlinepubs/000095399/functions/posix_memalign.html
>
> one wonders, esp. since its only needed for command line tools, if the
> following
> wouldn't do the trick by simply ignoring the alignment request:
>
> #ifndef HAVE_POSIX_MEMALIGN /*or equivalent*/
> /* int posix_memalign(void **memptr, size_t alignment, size_t size); */
> #define posix_memalign(mp,a,s) (((*mp = malloc(s)) == 0 ) ? errno : 0)
> #endif
>
> What alternatives (to ignoring alignment) exist? malloc() until you
> get one that is aligned right? The requirement that posix_memalign's
> memory can go to free() rules out wrappers that get too much and then
> return the first aligned address within.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.