diff mbox series

[FFmpeg-devel] avcodec/refstruct: Inline ff_refstruct_allocz()

Message ID AS8P250MB074402A3B7FAED8F469D34658FCFA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 12c4cf9f720a8996fd23cdef76783289d483a2cc
Headers show
Series [FFmpeg-devel] avcodec/refstruct: Inline ff_refstruct_allocz() | expand

Commit Message

Andreas Rheinhardt Oct. 8, 2023, 10:21 a.m. UTC
Suggested by James Almer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/refstruct.c | 5 -----
 libavcodec/refstruct.h | 6 +++++-
 2 files changed, 5 insertions(+), 6 deletions(-)

Comments

James Almer Oct. 8, 2023, 1:54 p.m. UTC | #1
On 10/8/2023 7:21 AM, Andreas Rheinhardt wrote:
> Suggested by James Almer.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>   libavcodec/refstruct.c | 5 -----
>   libavcodec/refstruct.h | 6 +++++-
>   2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/refstruct.c b/libavcodec/refstruct.c
> index 9a6575f987..2e055d539e 100644
> --- a/libavcodec/refstruct.c
> +++ b/libavcodec/refstruct.c
> @@ -113,11 +113,6 @@ void *ff_refstruct_alloc_ext_c(size_t size, unsigned flags, FFRefStructOpaque op
>       return obj;
>   }
>   
> -void *ff_refstruct_allocz(size_t size)
> -{
> -    return ff_refstruct_alloc_ext(size, 0, NULL, NULL);
> -}
> -
>   void ff_refstruct_unref(void *objp)
>   {
>       void *obj;
> diff --git a/libavcodec/refstruct.h b/libavcodec/refstruct.h
> index ee6936d77a..8b0723a982 100644
> --- a/libavcodec/refstruct.h
> +++ b/libavcodec/refstruct.h
> @@ -101,7 +101,11 @@ void *ff_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque,
>   /**
>    * Equivalent to ff_refstruct_alloc_ext(size, 0, NULL, NULL)
>    */
> -void *ff_refstruct_allocz(size_t size);
> +static inline
> +void *ff_refstruct_allocz(size_t size)
> +{
> +    return ff_refstruct_alloc_ext(size, 0, NULL, NULL);
> +}
>   
>   /**
>    * Decrement the reference count of the underlying object and automatically

LGTM of course.
diff mbox series

Patch

diff --git a/libavcodec/refstruct.c b/libavcodec/refstruct.c
index 9a6575f987..2e055d539e 100644
--- a/libavcodec/refstruct.c
+++ b/libavcodec/refstruct.c
@@ -113,11 +113,6 @@  void *ff_refstruct_alloc_ext_c(size_t size, unsigned flags, FFRefStructOpaque op
     return obj;
 }
 
-void *ff_refstruct_allocz(size_t size)
-{
-    return ff_refstruct_alloc_ext(size, 0, NULL, NULL);
-}
-
 void ff_refstruct_unref(void *objp)
 {
     void *obj;
diff --git a/libavcodec/refstruct.h b/libavcodec/refstruct.h
index ee6936d77a..8b0723a982 100644
--- a/libavcodec/refstruct.h
+++ b/libavcodec/refstruct.h
@@ -101,7 +101,11 @@  void *ff_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque,
 /**
  * Equivalent to ff_refstruct_alloc_ext(size, 0, NULL, NULL)
  */
-void *ff_refstruct_allocz(size_t size);
+static inline
+void *ff_refstruct_allocz(size_t size)
+{
+    return ff_refstruct_alloc_ext(size, 0, NULL, NULL);
+}
 
 /**
  * Decrement the reference count of the underlying object and automatically