diff mbox series

[FFmpeg-devel] avcodec/refstruct: inline ff_refstruct_pool_alloc()

Message ID 20240914004434.6368-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/refstruct: inline ff_refstruct_pool_alloc() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer Sept. 14, 2024, 12:44 a.m. UTC
Much like ff_refstruct_pool_alloc_ext(), it's a wrapper around
ff_refstruct_pool_alloc_ext_c().

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/refstruct.c |  5 -----
 libavcodec/refstruct.h | 17 ++++++++++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/refstruct.c b/libavcodec/refstruct.c
index f89af156c2..13778f3f58 100644
--- a/libavcodec/refstruct.c
+++ b/libavcodec/refstruct.c
@@ -332,11 +332,6 @@  static void refstruct_pool_uninit(FFRefStructOpaque unused, void *obj)
     }
 }
 
-FFRefStructPool *ff_refstruct_pool_alloc(size_t size, unsigned flags)
-{
-    return ff_refstruct_pool_alloc_ext(size, flags, NULL, NULL, NULL, NULL, NULL);
-}
-
 FFRefStructPool *ff_refstruct_pool_alloc_ext_c(size_t size, unsigned flags,
                                                FFRefStructOpaque opaque,
                                                int  (*init_cb)(FFRefStructOpaque opaque, void *obj),
diff --git a/libavcodec/refstruct.h b/libavcodec/refstruct.h
index c64ad62b6b..f9cd406bf2 100644
--- a/libavcodec/refstruct.h
+++ b/libavcodec/refstruct.h
@@ -220,11 +220,6 @@  typedef struct FFRefStructPool FFRefStructPool;
  */
 #define FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME                       (1 << 18)
 
-/**
- * Equivalent to ff_refstruct_pool_alloc(size, flags, NULL, NULL, NULL, NULL, NULL)
- */
-FFRefStructPool *ff_refstruct_pool_alloc(size_t size, unsigned flags);
-
 /**
  * Allocate an FFRefStructPool, potentially using complex callbacks.
  *
@@ -266,6 +261,18 @@  FFRefStructPool *ff_refstruct_pool_alloc_ext(size_t size, unsigned flags,
                                          init_cb, reset_cb, free_entry_cb, free_cb);
 }
 
+/**
+ * A wrapper around ff_refstruct_pool_alloc_ext_c() for the common case
+ * of no custom callbacks.
+ *
+ * @see ff_refstruct_pool_alloc_ext_c()
+ */
+static inline
+FFRefStructPool *ff_refstruct_pool_alloc(size_t size, unsigned flags)
+{
+    return ff_refstruct_pool_alloc_ext(size, flags, NULL, NULL, NULL, NULL, NULL);
+}
+
 /**
  * Get an object from the pool, reusing an old one from the pool when
  * available.