|
From: | Eric Blake |
Subject: | Re: [Qemu-devel] [PATCH v4 11/11] qga-win: demystify namespace striping |
Date: | Wed, 10 Oct 2018 12:19:20 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 10/4/18 8:20 AM, Marc-André Lureau wrote:
Hi On Thu, Oct 4, 2018 at 3:22 PM Tomáš Golembiovský <address@hidden> wrote:It was not obvious what exactly the cryptic string copying does to the GUID. This change makes the intent clearer.
In the subject line, s/striping/stripping/ (this is about performing a 'strip' operation on a prefix, but I read the subject as an instance of 'stripe' as in drawing a line or fragmenting data in a RAID).
+++ b/qga/commands-win32.c @@ -507,7 +507,14 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp) char dev_name[MAX_PATH]; char *buffer = NULL; GuestPCIAddress *pci = NULL; - char *name = g_strdup(&guid[4]); + char *name = NULL; + + if ((g_str_has_prefix(guid, "\\\\.\\") == TRUE) || + (g_str_has_prefix(guid, "\\\\?\\") == TRUE)) {
I find that 'cond == true' is redundant to just writing 'cond'. And that sentiment applies to both the <stdbool.h> 'bool' and to the glib abomination TRUE (why they had to invent their own boolean names, worse in every way compared to <stdbool.h>, is beyond me).
+ name = g_strdup(&guid[4]);I find "guid + 4" easier to read though
Concur. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |