On Wed, May 25, 2022 at 05:58:49PM -0400, rsbecker@xxxxxxxxxxxxx wrote: > >> > `data` is definitely uint32_t aligned, but this is a tradeoff, since > >> > if we wrote: > >> > > >> > uint32_t *data = xmmap(...); > >> > > >> > then I think we would have to change the case where ret is non-zero to be: > >> > > >> > if (data) > >> > munmap((void*)data, ...); > >> > > >> > and likewise, data_p is const. > >> > >> Doing it that way sounds great to me. That way, the type contains the > >> information we need up-front and the safety of the cast is obvious in > >> the place where the cast is needed. > >> > >> (Although my understanding is also that in C it's fine to pass a > >> uint32_t* to a function expecting a void*, so the second cast would > >> also not be needed.) > > I do not think c99 allows this in 100% of cases - specifically if > there a const void * involved. gcc does not care. I do not think c89 > cares either. I will watch out for it when this is merged. Thanks for the heads up. I looked through the results of "git grep '= xmmap'" to see if we had contemporary examples of either assigning to a non-'void *', or passing a non-'void *' variable to munmap. Luckily, we have both, so this shouldn't cause a problem. fixup! patch incoming shortly... Thanks, Taylor