提交 0f79480b 编写于 作者: J Ján Tomko

Replace some uses STREQLEN with STRPREFIX

Do not call it with a magic constant matching the length
of the pattern.
上级 13c34f81
......@@ -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 *)&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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册