On 10/4/18 8:20 AM, Marc-André Lureau wrote:
Hi

On Thu, Oct 4, 2018 at 3:22 PM Tomáš Golembiovský <tgole...@redhat.com> 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

Reply via email to