[libbluray-devel] [Git][videolan/libbluray][master] bd_refcnt_inc(): Add return value
Petri Hintukainen
gitlab at videolan.org
Sat Jan 30 17:32:05 UTC 2021
Petri Hintukainen pushed to branch master at VideoLAN / libbluray
Commits:
c8c6de16 by hpi1 at 2021-01-30T19:03:28+02:00
bd_refcnt_inc(): Add return value
- - - - -
5 changed files:
- ChangeLog
- src/libbluray/decoders/graphics_controller.c
- src/libbluray/decoders/overlay.h
- src/util/refcnt.c
- src/util/refcnt.h
Changes:
=====================================
ChangeLog
=====================================
@@ -1,4 +1,5 @@
- Add bd_event_name().
+- Add return value to bd_refcnt_inc().
2020-10-25: Version 1.2.1
- Add initial support for .fmts files.
=====================================
src/libbluray/decoders/graphics_controller.c
=====================================
@@ -639,9 +639,9 @@ static void _render_composition_object(GRAPHICS_CONTROLLER *gc,
}
/* exported */
-void bd_refcnt_inc(const void *obj)
+const void *bd_refcnt_inc(const void *obj)
{
- refcnt_inc(obj);
+ return refcnt_inc(obj);
}
/* exported */
=====================================
src/libbluray/decoders/overlay.h
=====================================
@@ -88,7 +88,7 @@ typedef struct bd_overlay_s {
it needs to use bd_refcnt_inc() and bd_refcnt_dec().
*/
-void bd_refcnt_inc(const void *);
+const void *bd_refcnt_inc(const void *); /* return object or NULL on invalid object */
void bd_refcnt_dec(const void *);
#if 0
=====================================
src/util/refcnt.c
=====================================
@@ -45,30 +45,32 @@ typedef struct bd_refcnt {
*
*/
-void refcnt_inc(const void *obj)
+const void *refcnt_inc(const void *obj)
{
BD_REFCNT *ref;
if (!obj) {
- return;
+ return NULL;
}
ref = ((const BD_REFCNT *)obj)[-1].me;
if (obj != (const void *)&ref[1]) {
BD_DEBUG(DBG_CRIT, "refcnt_inc(): invalid object\n");
- return;
+ return NULL;
}
if (!ref->counted) {
bd_mutex_init(&ref->mutex);
ref->counted = 1;
ref->count = 2;
- return;
+ return obj;
}
bd_mutex_lock(&ref->mutex);
++ref->count;
bd_mutex_unlock(&ref->mutex);
+
+ return obj;
}
void refcnt_dec(const void *obj)
=====================================
src/util/refcnt.h
=====================================
@@ -52,7 +52,7 @@ extern "C" {
BD_PRIVATE void *refcnt_realloc(void *obj, size_t sz, void (*cleanup)(void *));
-BD_PRIVATE void refcnt_inc(const void *obj);
+BD_PRIVATE const void *refcnt_inc(const void *obj) BD_USED;
BD_PRIVATE void refcnt_dec(const void *obj);
#ifdef __cplusplus
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/c8c6de162afa8c22d276e2e462bb28aec778279f
--
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/c8c6de162afa8c22d276e2e462bb28aec778279f
You're receiving this email because of your account on code.videolan.org.
More information about the libbluray-devel
mailing list