Re: [PATCH v14 07/13] ref-filter: add support for %(contents:lines=X)
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Aug 30, 2015, 17:09 UTC
- Message-ID
- <CAPig+cROyc7vxddkfGSsBayT9i=VSacxcEuuNkEFf+oYoUs9kg@mail.gmail.com>
- In-Reply-To
- <CAOLa=ZSgjrg60r6bdWfCHC+J9_q+ZWUHXc7j_9ePkdTBE1+-Kg@mail.gmail.com>
On Sun, Aug 30, 2015 at 1:02 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
Show 23 quoted lines
> On Sun, Aug 30, 2015 at 1:23 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> On Sat, Aug 29, 2015 at 10:12 AM, Karthik Nayak <karthik.188@gmail.com> 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.)