> Subject: Re: [Qemu-devel] [PATCH v7 05/28] bootindex: rework > add_boot_device_path function > > On Fri, Sep 05, 2014 at 04:37:13PM +0800, arei.gong...@huawei.com wrote: > [...] > > +static void del_original_boot_device(DeviceState *dev, const char *suffix) > > +{ > > + FWBootEntry *i; > > + > > + if (dev == NULL) { > > + return; > > + } > > + > > + QTAILQ_FOREACH(i, &fw_boot_order, link) { > > + if (suffix) { > > + if (i->dev == dev && !strcmp(i->suffix, suffix)) { > > + QTAILQ_REMOVE(&fw_boot_order, i, link); > > + g_free(i->suffix); > > + g_free(i); > > + > > + break; > > + } > > + } else { /* host-usb and scsi devices do not have a suffix */ > > + if (i->dev == dev) { > > + QTAILQ_REMOVE(&fw_boot_order, i, link); > > + g_free(i); > > + > > + break; > > + } > > + } > > g_free() and g_strcmp0() accept NULL as arguments, so you can replace > those 16 lines with: > > if (i->dev == dev && !g_strcmp0(i->suffix, suffix))) { > QTAILQ_REMOVE(&fw_boot_order, i, link); > g_free(i->suffix); > g_free(i); > break; > } > OK. Thanks for your point!
Best regards, -Gonglei