Subject: Re: [PATCH] ares_parse_txt_reply: add `record_start` field

Re: [PATCH] ares_parse_txt_reply: add `record_start` field

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 11 Dec 2014 09:54:47 +0100 (CET)

On Thu, 11 Dec 2014, Jakub Hrozek wrote:

>> You want me to add a couple of `void*`?
>
> I was thinking:
> uint8_t reserved[16];

Another way, which is one I've used elsewhere, is this:

   struct larger_in_future {
     int age; /* generation of struct */
     void *member; /* always present */
   }

And c-ares would always set age to 0 in the first generation. A future
extension of the struct would bump the age to 1 and extend the struct:

   struct larger_in_future {
     int age; /* generation of struct */
     void *member; /* always present */

     /* only present if 'age' is >= 1 */
     void *later;
   }

It means a program has to check age before accessing struct fields below
'member' which is a bit of an annoyance, but possibly doable as the bumping
shouldn't happen terrible often?

-- 
  / daniel.haxx.se
Received on 2014-12-11