util: Make virResizeN return void

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Jiri Denemark 2021-03-20 00:37:02 +01:00
parent 244204eccd
commit ea5e926bb6
2 changed files with 11 additions and 10 deletions

View File

@ -98,9 +98,9 @@ int virExpandN(void *ptrptr,
* failure, 'ptrptr' and 'allocptr' are not changed. Any newly
* allocated memory in 'ptrptr' is zero-filled.
*
* Returns zero on success, aborts on OOM
* Aborts on OOM
*/
int virResizeN(void *ptrptr,
void virResizeN(void *ptrptr,
size_t size,
size_t *allocptr,
size_t count,
@ -112,12 +112,13 @@ int virResizeN(void *ptrptr,
abort();
if (count + add <= *allocptr)
return 0;
return;
delta = count + add - *allocptr;
if (delta < *allocptr / 2)
delta = *allocptr / 2;
return virExpandN(ptrptr, size, allocptr, delta);
virExpandN(ptrptr, size, allocptr, delta);
}
/**

View File

@ -38,7 +38,7 @@ int virReallocN(void *ptrptr, size_t size, size_t count)
ATTRIBUTE_NONNULL(1);
int virExpandN(void *ptrptr, size_t size, size_t *count, size_t add)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
int virResizeN(void *ptrptr, size_t size, size_t *alloc, size_t count, size_t desired)
void virResizeN(void *ptrptr, size_t size, size_t *alloc, size_t count, size_t desired)
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);
@ -102,7 +102,7 @@ int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr,
*
* This macro is safe to use on arguments with side effects.
*
* Returns 0 on success, aborts on OOM
* Aborts on OOM
*/
#define VIR_RESIZE_N(ptr, alloc, count, add) \
virResizeN(&(ptr), sizeof(*(ptr)), &(alloc), count, add)