mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
Stop calling virAllocN directly from ESX code
The ESX code has a method esxVI_Alloc which would call virAllocN directly, instead of using the VIR_ALLOC_N macro. Remove this method and make the callers just use VIR_ALLOC as is normal practice. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
ce78098e88
commit
393cf4d69b
@ -51,8 +51,14 @@
|
|||||||
int \
|
int \
|
||||||
esxVI_##_type##_Alloc(esxVI_##_type **ptrptr) \
|
esxVI_##_type##_Alloc(esxVI_##_type **ptrptr) \
|
||||||
{ \
|
{ \
|
||||||
return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type), \
|
if (ptrptr == NULL || *ptrptr != NULL) { \
|
||||||
__FILE__, __FUNCTION__, __LINE__); \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
|
||||||
|
return -1; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
if (VIR_ALLOC(*ptrptr) < 0) \
|
||||||
|
return -1; \
|
||||||
|
return 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1735,21 +1741,6 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
|
|||||||
* - 'get' functions get information from a local object
|
* - 'get' functions get information from a local object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
|
||||||
esxVI_Alloc(void **ptrptr, size_t size, const char *file,
|
|
||||||
const char *function, size_t linenr)
|
|
||||||
{
|
|
||||||
if (ptrptr == NULL || *ptrptr != NULL) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return virAllocN(ptrptr, size, 1, true, VIR_FROM_THIS,
|
|
||||||
file, function, linenr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
esxVI_BuildSelectSet(esxVI_SelectionSpec **selectSet,
|
esxVI_BuildSelectSet(esxVI_SelectionSpec **selectSet,
|
||||||
const char *name, const char *type,
|
const char *name, const char *type,
|
||||||
|
@ -330,9 +330,6 @@ int esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
|
|||||||
* - 'get' functions get information from a local object
|
* - 'get' functions get information from a local object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int esxVI_Alloc(void **ptrptr, size_t size, const char *file,
|
|
||||||
const char *function, size_t linenr);
|
|
||||||
|
|
||||||
int esxVI_BuildSelectSet
|
int esxVI_BuildSelectSet
|
||||||
(esxVI_SelectionSpec **selectSet, const char *name,
|
(esxVI_SelectionSpec **selectSet, const char *name,
|
||||||
const char *type, const char *path, const char *selectSetNames);
|
const char *type, const char *path, const char *selectSetNames);
|
||||||
|
@ -43,10 +43,13 @@
|
|||||||
int \
|
int \
|
||||||
esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \
|
esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \
|
||||||
{ \
|
{ \
|
||||||
if (esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##__type), \
|
if (ptrptr == NULL || *ptrptr != NULL) { \
|
||||||
__FILE__, __FUNCTION__, __LINE__) < 0) { \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
|
\
|
||||||
|
if (VIR_ALLOC(*ptrptr) < 0) \
|
||||||
|
return -1; \
|
||||||
\
|
\
|
||||||
(*ptrptr)->_type = esxVI_Type_##__type; \
|
(*ptrptr)->_type = esxVI_Type_##__type; \
|
||||||
\
|
\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user