> -----Original Message----- > From: 陈梁 [mailto:chenliang0...@icloud.com] > Sent: Sunday, July 27, 2014 11:51 AM > Subject: Re: [Qemu-devel] [PATCH v3 1/7] bootindex: add > modify_boot_device_path function > > Hi > > + if (bootindex >= 0) { > > + node = g_malloc0(sizeof(FWBootEntry)); > > + node->bootindex = bootindex; > > + if (suffix) { > > + node->suffix = g_strdup(suffix); > > + } else if (old_entry) { > > + node->suffix = g_strdup(old_entry->suffix); > > + } else { > > + node->suffix = NULL; > > + } > > + node->dev = dev; > > + > > + /* add to the global boot list */ > > + QTAILQ_FOREACH(i, &fw_boot_order, link) { > > + if (i->bootindex < bootindex) { > > + continue; > > + } > > + QTAILQ_INSERT_BEFORE(i, node, link); > > + goto out; > > + } > > + > > + QTAILQ_INSERT_TAIL(&fw_boot_order, node, link); > > + } > > this code can be simply like this: > > suffix = suffix ? suffix : old_entry->suffix ? old_entry->suffix : NULL; > > add_boot_device_path(boot_index, dev, suffix) > Nice, thanks.
Best regards, -Gonglei