[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 05/28] bootindex: rework add_boot_device_path
From: |
Gonglei |
Subject: |
Re: [Qemu-devel] [PATCH v7 05/28] bootindex: rework add_boot_device_path function |
Date: |
Mon, 8 Sep 2014 19:54:49 +0800 |
> 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, address@hidden 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
- Re: [Qemu-devel] [PATCH v7 08/28] virtio-net: add bootindex to qom property, (continued)
[Qemu-devel] [PATCH v7 06/28] bootindex: support to set a existent device's bootindex to -1, arei.gonglei, 2014/09/05
[Qemu-devel] [PATCH v7 01/28] bootdevice: move bootdevice related code to new file bootdevice.c, arei.gonglei, 2014/09/05
[Qemu-devel] [PATCH v7 10/28] eepro100: add bootindex to qom property, arei.gonglei, 2014/09/05
[Qemu-devel] [PATCH v7 12/28] pcnet: add bootindex to qom property, arei.gonglei, 2014/09/05
[Qemu-devel] [PATCH v7 27/28] bootindex: move calling add_boot_device_patch to bootindex setter function, arei.gonglei, 2014/09/05
[Qemu-devel] [PATCH v7 05/28] bootindex: rework add_boot_device_path function, arei.gonglei, 2014/09/05