mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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:
parent
244204eccd
commit
ea5e926bb6
@ -98,13 +98,13 @@ 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,
|
||||
size_t size,
|
||||
size_t *allocptr,
|
||||
size_t count,
|
||||
size_t add)
|
||||
void virResizeN(void *ptrptr,
|
||||
size_t size,
|
||||
size_t *allocptr,
|
||||
size_t count,
|
||||
size_t add)
|
||||
{
|
||||
size_t delta;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user