esx: Replace almost all esxVI_String_DeepCopyValue vith VIR_STRDUP

This commit is contained in:
Matthias Bolte 2013-05-17 23:19:21 +02:00
parent 63a2e0b295
commit f5bf1f3a00
7 changed files with 26 additions and 33 deletions

View File

@ -183,7 +183,7 @@ esxParseVMXFileName(const char *fileName, void *opaque)
++tmp;
}
if (esxVI_String_DeepCopyValue(&strippedFileName, tmp) < 0) {
if (VIR_STRDUP(strippedFileName, tmp) < 0) {
goto cleanup;
}
@ -209,7 +209,7 @@ esxParseVMXFileName(const char *fileName, void *opaque)
/* Fallback to direct datastore name match */
if (result == NULL && STRPREFIX(fileName, "/vmfs/volumes/")) {
if (esxVI_String_DeepCopyValue(&copyOfFileName, fileName) < 0) {
if (VIR_STRDUP(copyOfFileName, fileName) < 0) {
goto cleanup;
}
@ -248,7 +248,7 @@ esxParseVMXFileName(const char *fileName, void *opaque)
/* If it's an absolute path outside of a datastore just use it as is */
if (result == NULL && *fileName == '/') {
/* FIXME: need to deal with Windows paths here too */
if (esxVI_String_DeepCopyValue(&result, fileName) < 0) {
if (VIR_STRDUP(result, fileName) < 0) {
goto cleanup;
}
}
@ -353,7 +353,7 @@ esxFormatVMXFileName(const char *fileName, void *opaque)
result = virBufferContentAndReset(&buffer);
} else if (*fileName == '/') {
/* FIXME: need to deal with Windows paths here too */
if (esxVI_String_DeepCopyValue(&result, fileName) < 0) {
if (VIR_STRDUP(result, fileName) < 0) {
goto cleanup;
}
} else {

View File

@ -478,10 +478,8 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
if (esxVI_HostPortGroupSpec_Alloc(&hostPortGroupSpec) < 0 ||
esxVI_HostNetworkPolicy_Alloc(&hostPortGroupSpec->policy) < 0 ||
esxVI_Int_Alloc(&hostPortGroupSpec->vlanId) < 0 ||
esxVI_String_DeepCopyValue(&hostPortGroupSpec->name,
def->portGroups[i].name) < 0 ||
esxVI_String_DeepCopyValue(&hostPortGroupSpec->vswitchName,
def->name) < 0) {
VIR_STRDUP(hostPortGroupSpec->name, def->portGroups[i].name) < 0 ||
VIR_STRDUP(hostPortGroupSpec->vswitchName, def->name) < 0) {
goto cleanup;
}

View File

@ -672,7 +672,7 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume,
virUUIDFormat(md5, uuid_string);
if (esxVI_String_DeepCopyValue(&def.key, uuid_string) < 0) {
if (VIR_STRDUP(def.key, uuid_string) < 0) {
goto cleanup;
}

View File

@ -1031,7 +1031,7 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
}
} else {
/* Fall back to the path as key */
if (esxVI_String_DeepCopyValue(&key, datastorePath) < 0) {
if (VIR_STRDUP(key, datastorePath) < 0) {
goto cleanup;
}
}
@ -1233,7 +1233,7 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool,
}
} else {
/* Fall back to the path as key */
if (esxVI_String_DeepCopyValue(&key, datastorePath) < 0) {
if (VIR_STRDUP(key, datastorePath) < 0) {
goto cleanup;
}
}

View File

@ -237,7 +237,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
return -1;
}
if (esxVI_String_DeepCopyValue(&copyOfDatastorePath, datastorePath) < 0) {
if (VIR_STRDUP(copyOfDatastorePath, datastorePath) < 0) {
goto cleanup;
}
@ -251,8 +251,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
}
if (datastoreName != NULL &&
esxVI_String_DeepCopyValue(datastoreName,
preliminaryDatastoreName) < 0) {
VIR_STRDUP(*datastoreName, preliminaryDatastoreName) < 0) {
goto cleanup;
}
@ -266,8 +265,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
}
if (directoryAndFileName != NULL &&
esxVI_String_DeepCopyValue(directoryAndFileName,
preliminaryDirectoryAndFileName) < 0) {
VIR_STRDUP(*directoryAndFileName, preliminaryDirectoryAndFileName) < 0) {
goto cleanup;
}
@ -279,8 +277,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
*tmp = '\0';
}
if (esxVI_String_DeepCopyValue(directoryName,
preliminaryDirectoryAndFileName) < 0) {
if (VIR_STRDUP(*directoryName, preliminaryDirectoryAndFileName) < 0) {
goto cleanup;
}
}

View File

@ -801,10 +801,10 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
if (esxVI_CURL_Alloc(&ctx->curl) < 0 ||
esxVI_CURL_Connect(ctx->curl, parsedUri) < 0 ||
esxVI_String_DeepCopyValue(&ctx->url, url) < 0 ||
esxVI_String_DeepCopyValue(&ctx->ipAddress, ipAddress) < 0 ||
esxVI_String_DeepCopyValue(&ctx->username, username) < 0 ||
esxVI_String_DeepCopyValue(&ctx->password, password) < 0) {
VIR_STRDUP(ctx->url, url) < 0 ||
VIR_STRDUP(ctx->ipAddress, ipAddress) < 0 ||
VIR_STRDUP(ctx->username, username) < 0 ||
VIR_STRDUP(ctx->password, password) < 0) {
return -1;
}
@ -1779,9 +1779,9 @@ esxVI_BuildSelectSet(esxVI_SelectionSpec **selectSet,
}
if (esxVI_TraversalSpec_Alloc(&traversalSpec) < 0 ||
esxVI_String_DeepCopyValue(&traversalSpec->name, name) < 0 ||
esxVI_String_DeepCopyValue(&traversalSpec->type, type) < 0 ||
esxVI_String_DeepCopyValue(&traversalSpec->path, path) < 0) {
VIR_STRDUP(traversalSpec->name, name) < 0 ||
VIR_STRDUP(traversalSpec->type, type) < 0 ||
VIR_STRDUP(traversalSpec->path, path) < 0) {
goto failure;
}
@ -1792,8 +1792,7 @@ esxVI_BuildSelectSet(esxVI_SelectionSpec **selectSet,
while (currentSelectSetName != NULL && *currentSelectSetName != '\0') {
if (esxVI_SelectionSpec_Alloc(&selectionSpec) < 0 ||
esxVI_String_DeepCopyValue(&selectionSpec->name,
currentSelectSetName) < 0 ||
VIR_STRDUP(selectionSpec->name, currentSelectSetName) < 0 ||
esxVI_SelectionSpec_AppendToList(&traversalSpec->selectSet,
selectionSpec) < 0) {
goto failure;
@ -3486,7 +3485,7 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx,
goto cleanup;
}
if (esxVI_String_DeepCopyValue(&fileName, directoryAndFileName) < 0) {
if (VIR_STRDUP(fileName, directoryAndFileName) < 0) {
goto cleanup;
}
} else {
@ -3506,8 +3505,7 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx,
goto cleanup;
}
if (esxVI_String_DeepCopyValue(&fileName,
directoryAndFileName + length + 1) < 0) {
if (VIR_STRDUP(fileName, directoryAndFileName + length + 1) < 0) {
goto cleanup;
}
}
@ -3803,7 +3801,7 @@ esxVI_LookupStorageVolumeKeyByDatastorePath(esxVI_Context *ctx,
if (*key == NULL) {
/* Other files don't have a UUID, fall back to the path as key */
if (esxVI_String_DeepCopyValue(key, datastorePath) < 0) {
if (VIR_STRDUP(*key, datastorePath) < 0) {
goto cleanup;
}
}

View File

@ -963,8 +963,8 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
(*dest)->type = src->type;
if (esxVI_String_DeepCopyValue(&(*dest)->other, src->other) < 0 ||
esxVI_String_DeepCopyValue(&(*dest)->value, src->value) < 0) {
if (VIR_STRDUP((*dest)->other, src->other) < 0 ||
VIR_STRDUP((*dest)->value, src->value) < 0) {
goto failure;
}