NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: _res in GNUMail



On Thu, Apr 05, 2012 at 05:14:56PM +0200, Riccardo Mottola wrote:
> struct __res_state state;
> 
> But then accessing the structure with "->" is wrong and the code becomes 
> like:
> 
>  if ((cw_res.options & RES_INIT) == 0)

Sorry for the confusion, this is mostly correct.

You do:

  __res_state my_res;
  memset(&my_res, 0, sizeof(my_res));
  res_ninit(&my_res);

and then just use it (like: my_res.options & RES_INIT....)

And before exiting you call

   res_ndestroy(&my_res);

to free any memory that libc might have stored in the state record.

Martin


Home | Main Index | Thread Index | Old Index