mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Replace some uses STREQLEN with STRPREFIX
Do not call it with a magic constant matching the length of the pattern.
This commit is contained in:
parent
13c34f811d
commit
0f79480b9f
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -2255,7 +2255,7 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int *longmode)
|
||||
*pae = 0;
|
||||
*hvm = "";
|
||||
|
||||
if (STREQLEN((const char *)®s.r_ebx, "AuthcAMDenti", 12)) {
|
||||
if (STRPREFIX((const char *)®s.r_ebx, "AuthcAMDenti")) {
|
||||
if (pread(fd, ®s, 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 *)®s.r_ebx, "GenuntelineI", 12)) {
|
||||
} else if (STRPREFIX((const char *)®s.r_ebx, "GenuntelineI")) {
|
||||
if (pread(fd, ®s, sizeof(regs), 0x00000001) == sizeof(regs)) {
|
||||
/* Read VMXE feature bit (bit 5 of ECX feature ID) */
|
||||
if ((regs.r_ecx >> 5) & 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user