virDomainNetDefPtr net = NULL;
char *ifname;
- if (virAsprintf(&ifname, "testnet%d", ifctr) < 0)
- return NULL;
+ ifname = g_strdup_printf("testnet%d", ifctr);
/* Generate network interface names */
if (!(net = virDomainNetFindByName(domdef, ifname)))
g_autoptr(virStorageVolDef) volDef = NULL;
/* Find storage volumes */
- if (virAsprintf(&vol_xpath, "/node/pool[%d]/volume", objidx) < 0)
- return -1;
+ vol_xpath = g_strdup_printf("/node/pool[%d]/volume", objidx);
num = virXPathNodeSet(vol_xpath, ctxt, &nodes);
if (num < 0)
return -1;
if (!volDef->target.path) {
- if (virAsprintf(&volDef->target.path, "%s/%s",
- def->target.path, volDef->name) < 0)
- return -1;
+ volDef->target.path = g_strdup_printf("%s/%s", def->target.path,
+ volDef->name);
}
if (!volDef->key)
if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- ignore_value(virAsprintf(&ret, "%shost", domain->name));
+ ret = g_strdup_printf("%shost", domain->name);
cleanup:
virDomainObjEndAPI(&vm);
info_ret[0]->mountpoint = g_strdup("/");
info_ret[0]->fstype = g_strdup("ext4");
info_ret[0]->devAlias[0] = g_strdup(name);
- if (virAsprintf(&info_ret[0]->name, "%s1", name) < 0)
- goto cleanup;
+ info_ret[0]->name = g_strdup_printf("%s1", name);
if (VIR_ALLOC(info_ret[1]) < 0 ||
VIR_ALLOC(info_ret[1]->devAlias) < 0)
info_ret[1]->mountpoint = g_strdup("/boot");
info_ret[1]->fstype = g_strdup("ext4");
info_ret[1]->devAlias[0] = g_strdup(name);
- if (virAsprintf(&info_ret[1]->name, "%s2", name) < 0)
- goto cleanup;
+ info_ret[1]->name = g_strdup_printf("%s2", name);
info_ret[0]->ndevAlias = info_ret[1]->ndevAlias = 1;
} else {
iface->addrs[0].type = VIR_IP_ADDR_TYPE_IPV4;
iface->addrs[0].prefix = 24;
- if (virAsprintf(&iface->addrs[0].addr, "192.168.0.%zu", 1 + i) < 0)
- goto cleanup;
+ iface->addrs[0].addr = g_strdup_printf("192.168.0.%zu", 1 + i);
}
return NULL;
}
- ignore_value(virAsprintf(&ret, defaultPoolSourcesNetFSXML,
- source->hosts[0].name));
+ ret = g_strdup_printf(defaultPoolSourcesNetFSXML, source->hosts[0].name);
return ret;
default:
goto cleanup;
}
- if (virAsprintf(&privvol->target.path, "%s/%s",
- def->target.path, privvol->name) < 0)
- goto cleanup;
+ privvol->target.path = g_strdup_printf("%s/%s", def->target.path,
+ privvol->name);
privvol->key = g_strdup(privvol->target.path);
if (virStoragePoolObjAddVol(obj, privvol) < 0)
}
def->available = (def->capacity - def->allocation);
- if (virAsprintf(&privvol->target.path, "%s/%s",
- def->target.path, privvol->name) < 0)
- goto cleanup;
+ privvol->target.path = g_strdup_printf("%s/%s", def->target.path,
+ privvol->name);
privvol->key = g_strdup(privvol->target.path);
if (virStoragePoolObjAddVol(obj, privvol) < 0)