On Sun, Aug 30, 2015 at 1:02 PM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote: > On Sun, Aug 30, 2015 at 1:23 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote: >> On Sat, Aug 29, 2015 at 10:12 AM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote: >>> struct atom_value { >>> const char *s; >>> struct align *align; >>> + struct contents *contents; >> >> Same question as for 'align': Does 'contents' need to be >> heap-allocated because it must exist beyond the lifetime of >> 'atom_value'? If not, making it just a plain member of 'atom_value' >> would simplify memory management (no need to free it). > > In this context that makes sense, as the value is only needed for the > current atom value. > >> Also, will 'align' and 'contents' ever be used at the same time? If >> not, it might make sense to place them in a 'union' (not for the >> memory saving, but to make it clear to the reader that their use is >> mutually exclusive). > > Not quite sure if it needs to be mutually exclusive (isn't that up to the user?) > But this can be done, as they're separate atoms and at a time only one of them > is used. I meant "mutually exclusive" in the sense of only one or the other of 'align' and 'contents' ever being used within a single 'atom_value' instance. (I wasn't referring to the user experience.) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html