* virAlloc:
* @ptrptr: pointer to pointer for address of allocated memory
* @size: number of bytes to allocate
- * @report: whether to report OOM error, if there is one
- * @domcode: error domain code
- * @filename: caller's filename
- * @funcname: caller's funcname
- * @linenr: caller's line number
*
* Allocate 'size' bytes of memory. Return the address of the
* allocated memory in 'ptrptr'. The newly allocated memory is
- * filled with zeros. If @report is true, OOM errors are
- * reported automatically.
+ * filled with zeros.
*
- * Returns -1 on failure to allocate, zero on success
+ * Returns zero on success, aborts on OOM
*/
int virAlloc(void *ptrptr,
- size_t size,
- bool report,
- int domcode,
- const char *filename,
- const char *funcname,
- size_t linenr)
+ size_t size)
{
*(void **)ptrptr = calloc(1, size);
- if (*(void **)ptrptr == NULL) {
- if (report)
- virReportOOMErrorFull(domcode, filename, funcname, linenr);
- return -1;
- }
+ if (*(void **)ptrptr == NULL)
+ abort();
+
return 0;
}
* @ptrptr: pointer to pointer for address of allocated memory
* @size: number of bytes to allocate
* @count: number of elements to allocate
- * @report: whether to report OOM error, if there is one
- * @domcode: error domain code
- * @filename: caller's filename
- * @funcname: caller's funcname
- * @linenr: caller's line number
*
* Allocate an array of memory 'count' elements long,
* each with 'size' bytes. Return the address of the
* allocated memory in 'ptrptr'. The newly allocated
- * memory is filled with zeros. If @report is true,
- * OOM errors are reported automatically.
+ * memory is filled with zeros.
*
- * Returns -1 on failure to allocate, zero on success
+ * Returns zero on success, aborts on OOM
*/
int virAllocN(void *ptrptr,
size_t size,
- size_t count,
- bool report,
- int domcode,
- const char *filename,
- const char *funcname,
- size_t linenr)
+ size_t count)
{
*(void**)ptrptr = calloc(count, size);
- if (*(void**)ptrptr == NULL) {
- if (report)
- virReportOOMErrorFull(domcode, filename, funcname, linenr);
- return -1;
- }
+ if (*(void**)ptrptr == NULL)
+ abort();
+
return 0;
}
* @ptrptr: pointer to pointer for address of allocated memory
* @size: number of bytes to allocate
* @count: number of elements in array
- * @report: whether to report OOM error, if there is one
- * @domcode: error domain code
- * @filename: caller's filename
- * @funcname: caller's funcname
- * @linenr: caller's line number
*
* Resize the block of memory in 'ptrptr' to be an array of
* 'count' elements, each 'size' bytes in length. Update 'ptrptr'
* with the address of the newly allocated memory. On failure,
* 'ptrptr' is not changed and still points to the original memory
* block. Any newly allocated memory in 'ptrptr' is uninitialized.
- * If @report is true, OOM errors are reported automatically.
*
- * Returns -1 on failure to allocate, zero on success
+ * Returns zero on success, aborts on OOM
*/
int virReallocN(void *ptrptr,
size_t size,
- size_t count,
- bool report,
- int domcode,
- const char *filename,
- const char *funcname,
- size_t linenr)
+ size_t count)
{
void *tmp;
- if (xalloc_oversized(count, size)) {
- if (report)
- virReportOOMErrorFull(domcode, filename, funcname, linenr);
- errno = ENOMEM;
- return -1;
- }
+ if (xalloc_oversized(count, size))
+ abort();
+
tmp = realloc(*(void**)ptrptr, size * count);
- if (!tmp && ((size * count) != 0)) {
- if (report)
- virReportOOMErrorFull(domcode, filename, funcname, linenr);
- return -1;
- }
+ if (!tmp && ((size * count) != 0))
+ abort();
+
*(void**)ptrptr = tmp;
return 0;
}
* @size: number of bytes per element
* @countptr: pointer to number of elements in array
* @add: number of elements to add
- * @report: whether to report OOM error, if there is one
- * @domcode: error domain code
- * @filename: caller's filename
- * @funcname: caller's funcname
- * @linenr: caller's line number
*
* Resize the block of memory in 'ptrptr' to be an array of
* '*countptr' + 'add' elements, each 'size' bytes in length.
* Update 'ptrptr' and 'countptr' with the details of the newly
* allocated memory. On failure, 'ptrptr' and 'countptr' are not
* changed. Any newly allocated memory in 'ptrptr' is zero-filled.
- * If @report is true, OOM errors are reported automatically.
*
- * Returns -1 on failure to allocate, zero on success
+ * Returns zero on success, aborts on OOM
*/
int virExpandN(void *ptrptr,
size_t size,
size_t *countptr,
- size_t add,
- bool report,
- int domcode,
- const char *filename,
- const char *funcname,
- size_t linenr)
+ size_t add)
{
- int ret;
+ if (*countptr + add < *countptr)
+ abort();
- if (*countptr + add < *countptr) {
- if (report)
- virReportOOMErrorFull(domcode, filename, funcname, linenr);
- errno = ENOMEM;
- return -1;
- }
- ret = virReallocN(ptrptr, size, *countptr + add, report,
- domcode, filename, funcname, linenr);
- if (ret == 0) {
- memset(*(char **)ptrptr + (size * *countptr), 0, size * add);
- *countptr += add;
- }
- return ret;
+ if (virReallocN(ptrptr, size, *countptr + add) < 0)
+ abort();
+ memset(*(char **)ptrptr + (size * *countptr), 0, size * add);
+ *countptr += add;
+ return 0;
}
/**
* @allocptr: pointer to number of elements allocated in array
* @count: number of elements currently used in array
* @add: minimum number of additional elements to support in array
- * @report: whether to report OOM error, if there is one
- * @domcode: error domain code
- * @filename: caller's filename
- * @funcname: caller's funcname
- * @linenr: caller's line number
*
* If 'count' + 'add' is larger than '*allocptr', then resize the
* block of memory in 'ptrptr' to be an array of at least 'count' +
* 'add' elements, each 'size' bytes in length. Update 'ptrptr' and
* 'allocptr' with the details of the newly allocated memory. On
* failure, 'ptrptr' and 'allocptr' are not changed. Any newly
- * allocated memory in 'ptrptr' is zero-filled. If @report is true,
- * OOM errors are reported automatically.
- *
+ * allocated memory in 'ptrptr' is zero-filled.
*
- * Returns -1 on failure to allocate, zero on success
+ * Returns zero on success, aborts on OOM
*/
int virResizeN(void *ptrptr,
size_t size,
size_t *allocptr,
size_t count,
- size_t add,
- bool report,
- int domcode,
- const char *filename,
- const char *funcname,
- size_t linenr)
+ size_t add)
{
size_t delta;
- if (count + add < count) {
- if (report)
- virReportOOMErrorFull(domcode, filename, funcname, linenr);
- errno = ENOMEM;
- return -1;
- }
+ if (count + add < count)
+ abort();
+
if (count + add <= *allocptr)
return 0;
delta = count + add - *allocptr;
if (delta < *allocptr / 2)
delta = *allocptr / 2;
- return virExpandN(ptrptr, size, allocptr, delta, report,
- domcode, filename, funcname, linenr);
+ return virExpandN(ptrptr, size, allocptr, delta);
}
/**
void virShrinkN(void *ptrptr, size_t size, size_t *countptr, size_t toremove)
{
if (toremove < *countptr) {
- ignore_value(virReallocN(ptrptr, size, *countptr -= toremove,
- false, 0, NULL, NULL, 0));
+ if (virReallocN(ptrptr, size, *countptr -= toremove) < 0)
+ abort();
} else {
virFree(ptrptr);
*countptr = 0;
* @inPlace: false if we should expand the allocated memory before
* moving, true if we should assume someone else *has
* already* done that.
- * @report: whether to report OOM error, if there is one
- * @domcode: error domain code
- * @filename: caller's filename
- * @funcname: caller's funcname
- * @linenr: caller's line number
*
* Re-allocate an array of *countptr elements, each sizeof(*ptrptr) bytes
* long, to be *countptr+add elements long, then appropriately move
* allocated memory in *ptrptr and the new size in *countptr. If
* newelems is NULL, the new elements at ptrptr[at] are instead filled
* with zero. at must be between [0,*countptr], except that -1 is
- * treated the same as *countptr for convenience. If @report is true,
- * OOM errors are reported automatically.
+ * treated the same as *countptr for convenience.
*
* Returns -1 on failure, 0 on success
*/
virInsertElementsN(void *ptrptr, size_t size, size_t at,
size_t *countptr,
size_t add, void *newelems,
- bool clearOriginal, bool inPlace,
- bool report,
- int domcode,
- const char *filename,
- const char *funcname,
- size_t linenr)
+ bool clearOriginal, bool inPlace)
{
if (at == -1) {
at = *countptr;
if (inPlace) {
*countptr += add;
- } else if (virExpandN(ptrptr, size, countptr, add, report,
- domcode, filename, funcname, linenr) < 0) {
- return -1;
+ } else {
+ if (virExpandN(ptrptr, size, countptr, add) < 0)
+ abort();
}
/* memory was successfully re-allocated. Move up all elements from
* @struct_size: size of initial struct
* @element_size: size of array elements
* @count: number of array elements to allocate
- * @report: whether to report OOM error, if there is one
- * @domcode: error domain code
- * @filename: caller's filename
- * @funcname: caller's funcname
- * @linenr: caller's line number
*
* Allocate struct_size bytes plus an array of 'count' elements, each
* of size element_size. This sort of allocation is useful for
* The caller of this type of API is expected to know the length of
* the array that will be returned and allocate a suitable buffer to
* contain the returned data. C99 refers to these variable length
- * objects as structs containing flexible array members. If @report
- * is true, OOM errors are reported automatically.
+ * objects as structs containing flexible array members.
*
* Returns -1 on failure, 0 on success
*/
int virAllocVar(void *ptrptr,
size_t struct_size,
size_t element_size,
- size_t count,
- bool report,
- int domcode,
- const char *filename,
- const char *funcname,
- size_t linenr)
+ size_t count)
{
size_t alloc_size = 0;
- if (VIR_ALLOC_VAR_OVERSIZED(struct_size, count, element_size)) {
- if (report)
- virReportOOMErrorFull(domcode, filename, funcname, linenr);
- errno = ENOMEM;
- return -1;
- }
+ if (VIR_ALLOC_VAR_OVERSIZED(struct_size, count, element_size))
+ abort();
alloc_size = struct_size + (element_size * count);
*(void **)ptrptr = calloc(1, alloc_size);
- if (*(void **)ptrptr == NULL) {
- if (report)
- virReportOOMErrorFull(domcode, filename, funcname, linenr);
- return -1;
- }
+ if (*(void **)ptrptr == NULL)
+ abort();
return 0;
}
/* Don't call these directly - use the macros below */
-int virAlloc(void *ptrptr, size_t size, bool report, int domcode,
- const char *filename, const char *funcname, size_t linenr)
+int virAlloc(void *ptrptr, size_t size)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
-int virAllocN(void *ptrptr, size_t size, size_t count, bool report, int domcode,
- const char *filename, const char *funcname, size_t linenr)
+int virAllocN(void *ptrptr, size_t size, size_t count)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
-int virReallocN(void *ptrptr, size_t size, size_t count, bool report, int domcode,
- const char *filename, const char *funcname, size_t linenr)
+int virReallocN(void *ptrptr, size_t size, size_t count)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
-int virExpandN(void *ptrptr, size_t size, size_t *count, size_t add, bool report,
- int domcode, const char *filename, const char *funcname, size_t linenr)
+int virExpandN(void *ptrptr, size_t size, size_t *count, size_t add)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
-int virResizeN(void *ptrptr, size_t size, size_t *alloc, size_t count, size_t desired,
- bool report, int domcode, const char *filename,
- const char *funcname, size_t linenr)
+int virResizeN(void *ptrptr, size_t size, size_t *alloc, size_t count, size_t desired)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
void virShrinkN(void *ptrptr, size_t size, size_t *count, size_t toremove)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
int virInsertElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr,
size_t add, void *newelem,
- bool clearOriginal, bool inPlace, bool report, int domcode,
- const char *filename, const char *funcname, size_t linenr)
+ bool clearOriginal, bool inPlace)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr,
size_t toremove, bool inPlace)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
-int virAllocVar(void *ptrptr, size_t struct_size, size_t element_size, size_t count,
- bool report, int domcode, const char *filename,
- const char *funcname, size_t linenr)
+int virAllocVar(void *ptrptr, size_t struct_size, size_t element_size, size_t count)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure (with OOM error reported), 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_ALLOC(ptr) virAlloc(&(ptr), sizeof(*(ptr)), true, VIR_FROM_THIS, \
- __FILE__, __FUNCTION__, __LINE__)
+#define VIR_ALLOC(ptr) virAlloc(&(ptr), sizeof(*(ptr)))
/**
* VIR_ALLOC_QUIET:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure, 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_ALLOC_QUIET(ptr) virAlloc(&(ptr), sizeof(*(ptr)), false, 0, NULL, NULL, 0)
+#define VIR_ALLOC_QUIET(ptr) VIR_ALLOC(ptr)
/**
* VIR_ALLOC_N:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure (with OOM error reported), 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_ALLOC_N(ptr, count) virAllocN(&(ptr), sizeof(*(ptr)), (count), true, \
- VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+#define VIR_ALLOC_N(ptr, count) virAllocN(&(ptr), sizeof(*(ptr)), (count))
/**
* VIR_ALLOC_N_QUIET:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure, 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_ALLOC_N_QUIET(ptr, count) virAllocN(&(ptr), sizeof(*(ptr)), (count), \
- false, 0, NULL, NULL, 0)
+#define VIR_ALLOC_N_QUIET(ptr, count) VIR_ALLOC_N(ptr, count)
/**
* VIR_REALLOC_N:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure (with OOM error reported), 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_REALLOC_N(ptr, count) virReallocN(&(ptr), sizeof(*(ptr)), (count), \
- true, VIR_FROM_THIS, __FILE__, \
- __FUNCTION__, __LINE__)
+#define VIR_REALLOC_N(ptr, count) virReallocN(&(ptr), sizeof(*(ptr)), (count))
/**
* VIR_REALLOC_N_QUIET:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure, 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_REALLOC_N_QUIET(ptr, count) virReallocN(&(ptr), sizeof(*(ptr)), (count), \
- false, 0, NULL, NULL, 0)
+#define VIR_REALLOC_N_QUIET(ptr, count) VIR_REALLOC_N(ptr, count)
/**
* VIR_EXPAND_N:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure (with OOM error reported), 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_EXPAND_N(ptr, count, add) \
- virExpandN(&(ptr), sizeof(*(ptr)), &(count), add, true, VIR_FROM_THIS, \
- __FILE__, __FUNCTION__, __LINE__)
+#define VIR_EXPAND_N(ptr, count, add) virExpandN(&(ptr), sizeof(*(ptr)), &(count), add)
/**
* VIR_EXPAND_N_QUIET:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure, 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_EXPAND_N_QUIET(ptr, count, add) \
- virExpandN(&(ptr), sizeof(*(ptr)), &(count), add, false, 0, NULL, NULL, 0)
+#define VIR_EXPAND_N_QUIET(ptr, count, add) VIR_EXPAND_N(ptr, count, add)
/**
* VIR_RESIZE_N:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure (with OOM error reported), 0 on success
+ * Returns 0 on success, aborts on OOM
*/
#define VIR_RESIZE_N(ptr, alloc, count, add) \
- virResizeN(&(ptr), sizeof(*(ptr)), &(alloc), count, add, true, \
- VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+ virResizeN(&(ptr), sizeof(*(ptr)), &(alloc), count, add)
/**
* VIR_RESIZE_N_QUIET:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure, 0 on success
+ * Returns 0 on success, aborts on OOM
*/
-#define VIR_RESIZE_N_QUIET(ptr, alloc, count, add) \
- virResizeN(&(ptr), sizeof(*(ptr)), &(alloc), count, add, \
- false, 0, NULL, NULL, 0)
+#define VIR_RESIZE_N_QUIET(ptr, alloc, count, add) VIR_RESIZE_N(ptr, alloc, count, add)
/**
* VIR_SHRINK_N:
*/
#define VIR_INSERT_ELEMENT(ptr, at, count, newelem) \
virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false, \
- true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+ VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false)
#define VIR_INSERT_ELEMENT_COPY(ptr, at, count, newelem) \
virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false, \
- true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+ VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false)
#define VIR_INSERT_ELEMENT_INPLACE(ptr, at, count, newelem) \
virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, true, \
- true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+ VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, true)
#define VIR_INSERT_ELEMENT_COPY_INPLACE(ptr, at, count, newelem) \
virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, true, \
- true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+ VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, true)
/* Quiet version of macros above */
#define VIR_INSERT_ELEMENT_QUIET(ptr, at, count, newelem) \
- virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false, \
- false, 0, NULL, NULL, 0)
+ VIR_INSERT_ELEMENT(ptr, at, count, newelem)
#define VIR_INSERT_ELEMENT_COPY_QUIET(ptr, at, count, newelem) \
- virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false, \
- false, 0, NULL, NULL, 0)
+ VIR_INSERT_ELEMENT_COPY(ptr, at, count, newelem)
#define VIR_INSERT_ELEMENT_INPLACE_QUIET(ptr, at, count, newelem) \
- virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, true, \
- false, 0, NULL, NULL, 0)
+ VIR_INSERT_ELEMENT_INPLACE(ptr, at, count, newelem)
#define VIR_INSERT_ELEMENT_COPY_INPLACE_QUIET(ptr, at, count, newelem) \
- virInsertElementsN(&(ptr), sizeof(*(ptr)), at, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, true, \
- false, 0, NULL, NULL, 0)
+ VIR_INSERT_ELEMENT_COPY_INPLACE(ptr, at, count, newelem)
/**
* VIR_APPEND_ELEMENT:
*/
#define VIR_APPEND_ELEMENT(ptr, count, newelem) \
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false, \
- true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+ VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false)
#define VIR_APPEND_ELEMENT_COPY(ptr, count, newelem) \
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false, \
- true, VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+ VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false)
#define VIR_APPEND_ELEMENT_INPLACE(ptr, count, newelem) \
ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
VIR_TYPEMATCH(ptr, &(newelem)), \
- &(newelem), true, true, false, \
- VIR_FROM_THIS, __FILE__, \
- __FUNCTION__, __LINE__))
+ &(newelem), true, true))
#define VIR_APPEND_ELEMENT_COPY_INPLACE(ptr, count, newelem) \
ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
VIR_TYPEMATCH(ptr, &(newelem)), \
- &(newelem), false, true, false, \
- VIR_FROM_THIS, __FILE__, \
- __FUNCTION__, __LINE__))
+ &(newelem), false, true))
/* Quiet version of macros above */
#define VIR_APPEND_ELEMENT_QUIET(ptr, count, newelem) \
- virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), true, false, \
- false, 0, NULL, NULL, 0)
+ VIR_APPEND_ELEMENT(ptr, count, newelem)
#define VIR_APPEND_ELEMENT_COPY_QUIET(ptr, count, newelem) \
- virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
- VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false, \
- false, 0, NULL, NULL, 0)
+ VIR_APPEND_ELEMENT_COPY(ptr, count, newelem)
/**
* VIR_DELETE_ELEMENT:
*
* This macro is safe to use on arguments with side effects.
*
- * Returns -1 on failure (with OOM error reported), 0 on success
+ * Returns 0 on success, aborts on OOM
*/
#define VIR_ALLOC_VAR(ptr, type, count) \
- virAllocVar(&(ptr), sizeof(*(ptr)), sizeof(type), (count), true, \
- VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+ virAllocVar(&(ptr), sizeof(*(ptr)), sizeof(type), (count))
/**
* VIR_ALLOC_VAR_QUIET:
*
* Returns -1 on failure, 0 on success
*/
-#define VIR_ALLOC_VAR_QUIET(ptr, type, count) \
- virAllocVar(&(ptr), sizeof(*(ptr)), sizeof(type), (count), false, 0, NULL, NULL, 0)
+#define VIR_ALLOC_VAR_QUIET(ptr, type, count) VIR_ALLOC_VAR(ptr, type, count)
/**
* VIR_FREE: