revenge of CALLOC_STRUCT

Alyssa Rosenzweig alyssa at collabora.com
Thu Dec 23 13:59:08 UTC 2021


Remind me the difference between MALLOC and malloc (etc)? Like, why
don't we s/MALLOC/malloc/g the whole codebase and drop u_memory.h? I
guess portability (?) even though this is presumably stdlib...

On Thu, Dec 23, 2021 at 08:35:38AM +1000, Dave Airlie wrote:
> Hey,
> 
> Happy holidays, and as though to consider over the break,
> 
> We have the vmware used MALLOC/FREE/CALLOC/CALLOC_STRUCT wrappers used
> throughout gallium.
> 
> We have ST_CALLOC_STRUCT in use in the mesa state tracker, not used in gallium.
> 
> Merging the state tracker into mesa proper, and even prior to this a
> few CALLOC_STRUCT have started to leak into src/mesa/*.
> 
> Now I don't think we want that, but CALLOC_STRUCT is a genuinely
> useful macro on it's own,
> I'm considering just defined a calloc_struct instead for the
> non-gallium use that goes with malloc/calloc/free.
> 
> Any opinions, or should mesa just get u_memory.h support for Xmas?
> 
> Dave.


More information about the mesa-dev mailing list