]> xenbits.xensource.com Git - libvirt.git/commitdiff
Replace some uses STREQLEN with STRPREFIX
authorJán Tomko <jtomko@redhat.com>
Fri, 24 Jun 2016 08:37:04 +0000 (10:37 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 24 Jun 2016 14:30:55 +0000 (16:30 +0200)
Do not call it with a magic constant matching the length
of the pattern.

src/qemu/qemu_command.c
src/storage/storage_backend_iscsi.c
src/storage/storage_backend_scsi.c
src/xen/xen_hypervisor.c

index 08c66b8800bff164d3f52a048d13169a152db592..0638a868af7ac5c15a34a6fb458440c4b22ad548 100644 (file)
@@ -3610,7 +3610,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
-    if (STREQLEN(def->os.machine, "s390-virtio", 10) &&
+    if (STRPREFIX(def->os.machine, "s390-virtio") &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon)
         def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
 
index 98d114110ca78082bebe8076272c252f94a39d29..832cf6537a094a714e41d9959d45900523be769d 100644 (file)
@@ -106,7 +106,7 @@ virStorageBackendISCSIGetHostNumber(const char *sysfs_path,
     }
 
     while ((direrr = virDirRead(sysdir, &dirent, sysfs_path)) > 0) {
-        if (STREQLEN(dirent->d_name, "target", strlen("target"))) {
+        if (STRPREFIX(dirent->d_name, "target")) {
             if (sscanf(dirent->d_name,
                        "target%u:", host) != 1) {
                 VIR_DEBUG("Failed to parse target '%s'", dirent->d_name);
index 558b3cf49c7e6e5d6c508d8ffb163a4db7146565..99504f4e002c3a5c74815587631144f7f7d29f3c 100644 (file)
@@ -350,7 +350,7 @@ getBlockDevice(uint32_t host,
         goto cleanup;
 
     while ((direrr = virDirRead(lun_dir, &lun_dirent, lun_path)) > 0) {
-        if (STREQLEN(lun_dirent->d_name, "block", 5)) {
+        if (STRPREFIX(lun_dirent->d_name, "block")) {
             if (strlen(lun_dirent->d_name) == 5) {
                 if (getNewStyleBlockDevice(lun_path,
                                            lun_dirent->d_name,
index fc9e1c6beced003bde6413d6f4e01ad983041e02..79b25b3e6cda138d39a92c0c6c5a7edaf071fa46 100644 (file)
@@ -2255,7 +2255,7 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int *longmode)
     *pae = 0;
     *hvm = "";
 
-    if (STREQLEN((const char *)&regs.r_ebx, "AuthcAMDenti", 12)) {
+    if (STRPREFIX((const char *)&regs.r_ebx, "AuthcAMDenti")) {
         if (pread(fd, &regs, sizeof(regs), 0x80000001) == sizeof(regs)) {
             /* Read secure virtual machine bit (bit 2 of ECX feature ID) */
             if ((regs.r_ecx >> 2) & 1)
@@ -2263,7 +2263,7 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int *longmode)
             if ((regs.r_edx >> 6) & 1)
                 *pae = 1;
         }
-    } else if (STREQLEN((const char *)&regs.r_ebx, "GenuntelineI", 12)) {
+    } else if (STRPREFIX((const char *)&regs.r_ebx, "GenuntelineI")) {
         if (pread(fd, &regs, sizeof(regs), 0x00000001) == sizeof(regs)) {
             /* Read VMXE feature bit (bit 5 of ECX feature ID) */
             if ((regs.r_ecx >> 5) & 1)