]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: delete VIR_ALLOC and VIR_ALLOC_N
authorJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 11:50:06 +0000 (13:50 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 17:19:22 +0000 (19:19 +0200)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/libvirt_private.syms
src/util/viralloc.c
src/util/viralloc.h

index 7cf8bea9622588665a77e999e53257b6f7955230..152083d2202547f51aadecb6798d05ed0ea0f355 100644 (file)
@@ -1614,8 +1614,6 @@ vir_g_strdup_vprintf;
 
 
 # util/viralloc.h
-virAlloc;
-virAllocN;
 virAllocVar;
 virDeleteElementsN;
 virDispose;
index e254416cdffa49aafded87e9d89d1a17c22dbfcc..0360b8a8aac738eaee254717ddbe0fb94dcc20b0 100644 (file)
 VIR_LOG_INIT("util.alloc");
 
 
-/**
- * virAlloc:
- * @ptrptr: pointer to pointer for address of allocated memory
- * @size: number of bytes to allocate
- *
- * Allocate  'size' bytes of memory. Return the address of the
- * allocated memory in 'ptrptr'. The newly allocated memory is
- * filled with zeros.
- *
- * Returns zero on success, aborts on OOM
- */
-int virAlloc(void *ptrptr,
-             size_t size)
-{
-    *(void **)ptrptr = g_malloc0(size);
-    return 0;
-}
-
-/**
- * virAllocN:
- * @ptrptr: pointer to pointer for address of allocated memory
- * @size: number of bytes to allocate
- * @count: number of elements to allocate
- *
- * 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.
- *
- * Returns zero on success, aborts on OOM
- */
-int virAllocN(void *ptrptr,
-              size_t size,
-              size_t count)
-{
-    *(void**)ptrptr = g_malloc0_n(count, size);
-    return 0;
-}
-
 /**
  * virReallocN:
  * @ptrptr: pointer to pointer for address of allocated memory
index a50cd5d63218280de4baf30f10946036f8ea7ba3..1abd94fac45663367eb3a35ae2c2ea0c600e7e8b 100644 (file)
  */
 
 /* Don't call these directly - use the macros below */
-int virAlloc(void *ptrptr, size_t size)
-    G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1);
-int virAllocN(void *ptrptr, size_t size, size_t count)
-    G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1);
 int virReallocN(void *ptrptr, size_t size, size_t count)
     G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1);
 int virExpandN(void *ptrptr, size_t size, size_t *count, size_t add)
@@ -61,35 +57,6 @@ void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countpt
 void virDisposeString(char **strptr)
     ATTRIBUTE_NONNULL(1);
 
-/**
- * VIR_ALLOC:
- * @ptr: pointer to hold address of allocated memory
- *
- * Allocate sizeof(*ptr) bytes of memory and store
- * the address of allocated memory in 'ptr'. Fill the
- * newly allocated memory with zeros.
- *
- * This macro is safe to use on arguments with side effects.
- *
- * Returns 0 on success, aborts on OOM
- */
-#define VIR_ALLOC(ptr) virAlloc(&(ptr), sizeof(*(ptr)))
-
-/**
- * VIR_ALLOC_N:
- * @ptr: pointer to hold address of allocated memory
- * @count: number of elements to allocate
- *
- * Allocate an array of 'count' elements, each sizeof(*ptr)
- * bytes long and store the address of allocated memory in
- * 'ptr'. Fill the newly allocated memory with zeros.
- *
- * This macro is safe to use on arguments with side effects.
- *
- * Returns 0 on success, aborts on OOM
- */
-#define VIR_ALLOC_N(ptr, count) virAllocN(&(ptr), sizeof(*(ptr)), (count))
-
 /**
  * VIR_REALLOC_N:
  * @ptr: pointer to hold address of allocated memory