Re: [PATCH v5 02/17] pack-mtimes: support reading .mtimes files
- From
Taylor Blau <me@ttaylorr.com>
- Date
- May 25, 2022, 22:59 UTC
- Message-ID
- <Yo605oy4gfQmJ+VE@nand.local>
- In-Reply-To
- <01df01d87082$a0757020$e1605060$@nexbridge.com>
On Wed, May 25, 2022 at 05:58:49PM -0400, rsbecker@nexbridge.com wrote:
Show 23 quoted lines
> >> > `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