All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: Denis Kenzior <denkenz@gmail.com>
Cc: ell@lists.01.org, ell@lists.linux.dev
Subject: Re: [PATCH 07/14] netconfig: Add getters for DNS addresses and domain names
Date: Sat, 18 Jun 2022 02:38:26 +0200	[thread overview]
Message-ID: <CAOq732KHUW1zSHR1G6=fK9yhYiHYeOLCZ3jUAmSt_NUGTJroLw@mail.gmail.com> (raw)
In-Reply-To: <da1459dd-2402-161e-b24f-f55a02356a31@gmail.com>

Hi Denis,

On Fri, 17 Jun 2022 at 18:32, Denis Kenzior <denkenz@gmail.com> wrote:
> Hi Andrew,
>
> On 6/15/22 17:47, Andrew Zaborowski wrote:
> > ---
> >   ell/ell.sym     |  2 ++
> >   ell/netconfig.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++
> >   ell/netconfig.h |  2 ++
> >   3 files changed, 68 insertions(+)
> >
>
> So I applied all patches in this series

Great.

> except this one.  Just a minor nit here:
>
> > diff --git a/ell/ell.sym b/ell/ell.sym
> > index 50f8909..d74e8c9 100644
> > --- a/ell/ell.sym
> > +++ b/ell/ell.sym
> > @@ -757,6 +757,8 @@ global:
> >       l_netconfig_apply_rtnl;
> >       l_netconfig_get_addresses;
> >       l_netconfig_get_routes;
> > +     l_netconfig_get_dns_list;
> > +     l_netconfig_get_domain_names;
> >   local:
> >       *;
> >   };
> > diff --git a/ell/netconfig.c b/ell/netconfig.c
> > index ce5bfe3..94faef0 100644
> > --- a/ell/netconfig.c
> > +++ b/ell/netconfig.c
> > @@ -1425,3 +1425,67 @@ LIB_EXPORT const struct l_queue_entry *l_netconfig_get_routes(
> >
> >       return l_queue_get_entries(netconfig->routes.current);
> >   }
> > +
> > +/* Returns a new strv array to be freed by the caller */
> > +LIB_EXPORT char **l_netconfig_get_dns_list(struct l_netconfig *netconfig)
> > +{
> > +     char **ret = NULL;
> > +     const struct l_dhcp_lease *v4_lease;
> > +     const struct l_dhcp6_lease *v6_lease;
> > +
> > +#define CONCAT(dest, src, free)              \
>
> Why do we define this in the function body itself?  That seems weird for a macro
> that is used outside of this function.

True, I could have placed it before the function start.

>
> > +     do {                            \
> > +             char **tmp = src;       \
> > +             tmp = free ? tmp : l_strv_copy(tmp);    \
> > +             if (!dest)              \
> > +                     dest = tmp;     \
> > +             else if (tmp) {         \
> > +                     unsigned int destlen = l_strv_length(dest);     \
> > +                     unsigned int srclen = l_strv_length(tmp);       \
> > +                     dest = l_realloc(dest, sizeof(char *) * \
> > +                             (destlen + srclen + 1));        \
> > +                     memcpy(dest + destlen, tmp, sizeof(char *) *    \
> > +                                     (srclen + 1));  \
> > +                     l_free(tmp);    \
> > +             }                       \
> > +     } while (0)
>
> But really, can't we just turn this macro into a static convenience function
> instead?  Let the compiler decide whether inlining is appropriate.

Ok.

Best regards

      parent reply	other threads:[~2022-06-18  0:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 22:47 [PATCH 01/14] netconfig: Reset {v4, v6}_configured to false on netconfig stop Andrew Zaborowski
2022-06-15 22:47 ` [PATCH 07/14] netconfig: Add getters for DNS addresses and domain names Andrew Zaborowski
     [not found]   ` <da1459dd-2402-161e-b24f-f55a02356a31@gmail.com>
2022-06-18  0:38     ` Andrew Zaborowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOq732KHUW1zSHR1G6=fK9yhYiHYeOLCZ3jUAmSt_NUGTJroLw@mail.gmail.com' \
    --to=andrew.zaborowski@intel.com \
    --cc=denkenz@gmail.com \
    --cc=ell@lists.01.org \
    --cc=ell@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.