Subject: Re: [PATCH] ares_free_reply (Was: Re: [PATCH] ares_parse_txt_reply)

Re: [PATCH] ares_free_reply (Was: Re: [PATCH] ares_parse_txt_reply)

From: Yang Tse <yangsita_at_gmail.com>
Date: Mon, 2 Nov 2009 19:59:49 +0100

2009/11/2, Jakub Hrozek wrote:

> A patch is attached. I did factor in some of Yang's suggestions but so
> far it only works for SRV and TXT parsing routines..I'm not sure if what
> he posted (although a good plan!) is plan for the upcoming release or
> the next one and I did not want to touch existing (released) API much.

Let's first focus on the 'ares private internal struct' named
'ares_reply_private' in the patch vs the one named 'ares_data' in my
previous post. Copied both below for easier reference.

struct ares_reply_private {
  ares_datatype type;
  unsigned int mark; /* a private magic number */
  union {
      struct ares_txt_reply txt;
      struct ares_srv_reply srv;
  } data;
};

struct ares_data {
  ares_datatype type;
  unsigned int mark;
  void *data;
};

It is obvious that the difference is directly storing an
ares_[txt|srv]_reply struct in the 'ares private internal struct' or
storing a pointer to a dynamically allocated ares_[txt|srv]_reply
struct.

Hmm, I've started writing a theoretical comparison of both approaches,
but I've deleted it all. Tomorrow most probably.I'm going to code my
version, and afterwards I'll comment.

-- 
-=[Yang]=-
Received on 2009-11-02