From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sc0wt-0006A1-GM for qemu-devel@nongnu.org; Tue, 05 Jun 2012 17:05:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sc0wr-0003YW-OC for qemu-devel@nongnu.org; Tue, 05 Jun 2012 17:05:55 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:56079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sc0wr-0003YH-Fh for qemu-devel@nongnu.org; Tue, 05 Jun 2012 17:05:53 -0400 Received: by pbbro12 with SMTP id ro12so8654156pbb.4 for ; Tue, 05 Jun 2012 14:05:51 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4FCE74AA.7030506@redhat.com> Date: Tue, 05 Jun 2012 23:05:46 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1337683555-13301-1-git-send-email-lersek@redhat.com> <1337683555-13301-16-git-send-email-lersek@redhat.com> In-Reply-To: <1337683555-13301-16-git-send-email-lersek@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 15/16] convert net_init_bridge() to NetClientOptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: qemu-devel@nongnu.org Il 22/05/2012 12:45, Laszlo Ersek ha scritto: > Signed-off-by: Laszlo Ersek > --- > net/tap.c | 23 ++++++++++++----------- > 1 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/net/tap.c b/net/tap.c > index 7501eba..fdaab2b 100644 > --- a/net/tap.c > +++ b/net/tap.c > @@ -512,21 +512,22 @@ static int net_bridge_run_helper(const char *helper, const char *bridge) > return -1; > } > > -int net_init_bridge(QemuOpts *opts, const NetClientOptions *new_opts, > +int net_init_bridge(QemuOpts *old_opts, const NetClientOptions *opts, > const char *name, VLANState *vlan) > { > + const NetdevBridgeOptions *bridge; > + const char *helper, *br; > + > TAPState *s; > int fd, vnet_hdr; > > - if (!qemu_opt_get(opts, "br")) { > - qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE); > - } > - if (!qemu_opt_get(opts, "helper")) { > - qemu_opt_set(opts, "helper", DEFAULT_BRIDGE_HELPER); > - } > + assert(opts->kind == NET_CLIENT_OPTIONS_KIND_BRIDGE); > + bridge = opts->bridge; > + > + helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER; > + br = bridge->has_br ? bridge->br : DEFAULT_BRIDGE_INTERFACE; Don't hate me for this, but why not do the same for strdup calls? foo = bar->has_foo ? g_strdup(bar->foo) : NULL; earlier in the series? Reviewed-by: Paolo Bonzini Paolo