vlc | branch: master | Romain Vimont <[email protected]> | Thu Jul 5 10:30:49 2018 +0200| [bb6df23f48cd05c1505161f7a0b3bd0657745ca8] | committer: Steve Lhomme
core: use refcounter helper for input items Signed-off-by: Steve Lhomme <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bb6df23f48cd05c1505161f7a0b3bd0657745ca8 --- src/input/item.c | 6 +++--- src/input/item.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/input/item.c b/src/input/item.c index 35836606d1..a54b581c05 100644 --- a/src/input/item.c +++ b/src/input/item.c @@ -471,7 +471,7 @@ input_item_t *input_item_Hold( input_item_t *p_item ) { input_item_owner_t *owner = item_owner(p_item); - atomic_fetch_add( &owner->refs, 1 ); + vlc_atomic_rc_inc( &owner->rc ); return p_item; } @@ -479,7 +479,7 @@ void input_item_Release( input_item_t *p_item ) { input_item_owner_t *owner = item_owner(p_item); - if( atomic_fetch_sub(&owner->refs, 1) != 1 ) + if( !vlc_atomic_rc_dec( &owner->rc ) ) return; vlc_event_manager_fini( &p_item->event_manager ); @@ -1060,7 +1060,7 @@ input_item_NewExt( const char *psz_uri, const char *psz_name, if( unlikely(owner == NULL) ) return NULL; - atomic_init( &owner->refs, 1 ); + vlc_atomic_rc_init( &owner->rc ); input_item_t *p_input = &owner->item; vlc_event_manager_t * p_em = &p_input->event_manager; diff --git a/src/input/item.h b/src/input/item.h index dce1dfc058..bce49777f8 100644 --- a/src/input/item.h +++ b/src/input/item.h @@ -25,7 +25,7 @@ #define LIBVLC_INPUT_ITEM_H 1 #include "input_interface.h" -#include <stdatomic.h> +#include <vlc_atomic.h> void input_item_SetErrorWhenReading( input_item_t *p_i, bool b_error ); void input_item_UpdateTracksInfo( input_item_t *item, const es_format_t *fmt ); @@ -34,7 +34,7 @@ bool input_item_ShouldPreparseSubItems( input_item_t *p_i ); typedef struct input_item_owner { input_item_t item; - atomic_uint refs; + vlc_atomic_rc_t rc; } input_item_owner_t; # define item_owner(item) ((struct input_item_owner *)(item)) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
