[libvirt PATCH 5/7] util: Make virExpandN 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 | 14 ++++++--------
 src/util/viralloc.h |  4 ++--
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index cd770eb601..81f5ba9a09 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -66,12 +66,12 @@ int virReallocN(void *ptrptr,
  * allocated memory. On failure, 'ptrptr' and 'countptr' are not
  * changed. Any newly allocated memory in 'ptrptr' is zero-filled.
  *
- * Returns zero on success, aborts on OOM
+ * Aborts on OOM
  */
-int virExpandN(void *ptrptr,
-               size_t size,
-               size_t *countptr,
-               size_t add)
+void virExpandN(void *ptrptr,
+                size_t size,
+                size_t *countptr,
+                size_t add)
 {
     if (*countptr + add < *countptr)
         abort();
@@ -80,7 +80,6 @@ int virExpandN(void *ptrptr,
         abort();
     memset(*(char **)ptrptr + (size * *countptr), 0, size * add);
     *countptr += add;
-    return 0;
 }
 
 /**
@@ -192,8 +191,7 @@ virInsertElementsN(void *ptrptr, size_t size, size_t at,
     if (inPlace) {
         *countptr += add;
     } else {
-        if (virExpandN(ptrptr, size, countptr, add) < 0)
-            abort();
+        virExpandN(ptrptr, size, countptr, add);
     }
 
     /* memory was successfully re-allocated. Move up all elements from
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 878c9485cf..6051c91913 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -36,7 +36,7 @@
 /* Don't call these directly - use the macros below */
 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)
+void virExpandN(void *ptrptr, size_t size, size_t *count, size_t add)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
 void virResizeN(void *ptrptr, size_t size, size_t *alloc, size_t count, size_t desired)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
@@ -78,7 +78,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_EXPAND_N(ptr, count, add) virExpandN(&(ptr), sizeof(*(ptr)), &(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