GSoC/GCI Archive
Google Code-in 2012 BRL-CAD

Research offset macro consolidation

completed by: Cezar

mentors: Sean

BRL-CAD's utility library provides two offset wrapper functions bu_offsetof() and bu_offsetofarray() that determine the offset into a structure.  Investigate what is required to remove the latter array-variant.  This should be doable by either consolidating all calls into bu_offsetof() and changing the callers (e.g., offsetof+sizeof offset), OR by consolidating both macros into a new interface.

This is a portability minefield, so try to find a proof-of-concept approach first.  Submit a demo .c file that just includes bu.h and shows that the behavior is preserved.