Am 15.02.2012 10:38, schrieb Michael S. Tsirkin: > why does slirp have all these > defines in the first place? > > slirp/mbuf.h:#define m_nextpkt m_hdr.mh_nextpkt > slirp/mbuf.h:#define ifs_next m_nextpkt > > Seriously, #define for a field name?
We have some such #defines in ibm8514 graphics card code, too (not yet upstream). It is handy to make code match the datasheet while hiding some of the implementation details, like two levels of array accesses into implementation-defined-or-whatever registers. Doesn't seem to apply here obviously. Maybe historically m_hdr.mh_nextpkt was m_nextpkt and someone tried to avoid a full refactoring. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg