[FFmpeg-devel] [PATCH] avcodec/refstruct: inline ff_refstruct_pool_alloc()
James Almer
jamrial at gmail.com
Sat Sep 14 03:44:34 EEST 2024
Much like ff_refstruct_pool_alloc_ext(), it's a wrapper around
ff_refstruct_pool_alloc_ext_c().
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/refstruct.c | 5 -----
libavcodec/refstruct.h | 17 ++++++++++++-----
2 files changed, 12 insertions(+), 10 deletions(-)
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.
--
2.46.0
More information about the ffmpeg-devel
mailing list