[libvirt PATCH 3/7] util: Make virResizeN return void

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/util/viralloc.c | 17 +++++++++--------
 src/util/viralloc.h |  4 ++--
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index 1317537c8a..cd770eb601 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -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);
 }
 
 /**
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index d656d4ba0e..878c9485cf 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -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)
-- 
2.31.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux