qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 1/7] bootindex: add modify_boot_device_path f


From: 陈梁
Subject: Re: [Qemu-devel] [PATCH v3 1/7] bootindex: add modify_boot_device_path function
Date: Sun, 27 Jul 2014 11:51:03 +0800

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) 

Best regards
Chen Liang



reply via email to

[Prev in Thread] Current Thread [Next in Thread]