Re: [PATCH 01/19] revision.h: avoid bit fields in struct rev_info
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- May 8, 2019, 14:41 UTC
- Message-ID
- <CACsJy8DEjBS-aiWqDe2AU56rJBVZ4Po6c-C7GxR4QDNiGSiZoQ@mail.gmail.com>
- In-Reply-To
- <0509589b-7a92-6c05-e404-65a9b2bf5666@gmail.com>
On Wed, May 8, 2019 at 9:07 PM Derrick Stolee <stolee@gmail.com> wrote:
Show 14 quoted lines
> > On 5/8/2019 7:12 AM, Nguyễn Thái Ngọc Duy wrote: > > Bitfield addresses cannot be passed around in a pointer. This makes it > > hard to use parse-options to set/unset them. Turn this struct to > > normal integers. This of course increases the size of this struct > > multiple times, but since we only have a handful of rev_info variables > > around, memory consumption is not at all a concern. > > I think you are right that this memory trade-off shouldn't be a problem. > > What worries me instead is that we are using an "internal" data structure > for option parsing. Would it make more sense to create a struct for use > in the parse_opts method and a method that translates those options into > the bitfield in struct rev_info?
But we are doing that now (option parsing) using the same data structure. Why would changing from a custom parser to parse_options() affect what fields it should or should not touch in rev_info? Genuine question. Maybe you could elaborate more about "internal". I probably missed something. Or maybe this is a good opportunity to separate intermediate option parsing variables from the rest of rev_info?
-- Duy