<html><head></head><body>Hi,<br><br>I know. But I don't really like to fix bugs silently. And patch could be back-ported.<br><br><div class="gmail_quote">Le 28 septembre 2020 08:38:19 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">You don't need patch [1/3] with this patch.<br><br>On 2020-09-27 20:04, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Nothing good will happen if setting the preparsed flag is ignored<br>because the meta allocation failed. And in practice, it is almost<br>always created anyway. So just create one up-front.<br><br>This also simplifies the code quite a bit.<hr> src/input/item.c | 55 +++++++++++-------------------------------------<br> 1 file changed, 12 insertions(+), 43 deletions(-)<br><br>diff --git a/src/input/item.c b/src/input/item.c<br>index 7a69f5b448..44db7acb0b 100644<br>--- a/src/input/item.c<br>+++ b/src/input/item.c<br>@@ -71,9 +71,6 @@ void input_item_SetPreparsed( input_item_t *p_i, bool b_preparsed )<br> <br> vlc_mutex_lock( &p_i->lock );<br> <br>- if( !p_i->p_meta )<br>- p_i->p_meta = vlc_meta_New();<br>-<br> int status = vlc_meta_GetStatus(p_i->p_meta);<br> int new_status;<br> if( b_preparsed )<br>@@ -100,9 +97,6 @@ void input_item_SetArtNotFound( input_item_t *p_i, bool b_not_found )<br> {<br> vlc_mutex_lock( &p_i->lock );<br> <br>- if( !p_i->p_meta )<br>- p_i->p_meta = vlc_meta_New();<br>-<br> int status = vlc_meta_GetStatus(p_i->p_meta);<br> <br> if( b_not_found )<br>@@ -119,9 +113,6 @@ void input_item_SetArtFetched( input_item_t *p_i, bool b_art_fetched )<br> {<br> vlc_mutex_lock( &p_i->lock );<br> <br>- if( !p_i->p_meta )<br>- p_i->p_meta = vlc_meta_New();<br>-<br> int status = vlc_meta_GetStatus(p_i->p_meta);<br> <br> if( b_art_fetched )<br>@@ -137,8 +128,6 @@ void input_item_SetArtFetched( input_item_t *p_i, bool b_art_fetched )<br> void input_item_SetMeta( input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz_val )<br> {<br> vlc_mutex_lock( &p_i->lock );<br>- if( !p_i->p_meta )<br>- p_i->p_meta = vlc_meta_New();<br> vlc_meta_Set( p_i->p_meta, meta_type, psz_val );<br> vlc_mutex_unlock( &p_i->lock );<br> <br>@@ -237,11 +226,6 @@ bool input_item_MetaMatch( input_item_t *p_i,<br> {<br> vlc_mutex_lock( &p_i->lock );<br> <br>- if( !p_i->p_meta )<br>- {<br>- vlc_mutex_unlock( &p_i->lock );<br>- return false;<br>- }<br> const char *psz_meta = vlc_meta_Get( p_i->p_meta, meta_type );<br> bool b_ret = psz_meta && strcasestr( psz_meta, psz );<br> <br>@@ -255,9 +239,6 @@ const char *input_item_GetMetaLocked(input_item_t *item,<br> {<br> vlc_mutex_assert(&item->lock);<br> <br>- if (!item->p_meta)<br>- return NULL;<br>-<br> return vlc_meta_Get(item->p_meta, meta_type);<br> }<br> <br>@@ -276,13 +257,6 @@ char *input_item_GetTitleFbName( input_item_t *p_item )<br> char *psz_ret;<br> vlc_mutex_lock( &p_item->lock );<br> <br>- if( !p_item->p_meta )<br>- {<br>- psz_ret = p_item->psz_name ? strdup( p_item->psz_name ) : NULL;<br>- vlc_mutex_unlock( &p_item->lock );<br>- return psz_ret;<br>- }<br>-<br> const char *psz_title = vlc_meta_Get( p_item->p_meta, vlc_meta_Title );<br> if( !EMPTY_STR( psz_title ) )<br> psz_ret = strdup( psz_title );<br>@@ -439,7 +413,7 @@ char *input_item_GetNowPlayingFb( input_item_t *p_item )<br> bool input_item_IsPreparsed( input_item_t *p_item )<br> {<br> vlc_mutex_lock( &p_item->lock );<br>- bool b_preparsed = p_item->p_meta ? ( vlc_meta_GetStatus(p_item->p_meta) & ITEM_PREPARSED ) != 0 : false;<br>+ bool b_preparsed = vlc_meta_GetStatus(p_item->p_meta) & ITEM_PREPARSED;<br> vlc_mutex_unlock( &p_item->lock );<br> <br> return b_preparsed;<br>@@ -448,7 +422,7 @@ bool input_item_IsPreparsed( input_item_t *p_item )<br> bool input_item_IsArtFetched( input_item_t *p_item )<br> {<br> vlc_mutex_lock( &p_item->lock );<br>- bool b_fetched = p_item->p_meta ? ( vlc_meta_GetStatus(p_item->p_meta) & ITEM_ART_FETCHED ) != 0 : false;<br>+ bool b_fetched = vlc_meta_GetStatus(p_item->p_meta) & ITEM_ART_FETCHED;<br> vlc_mutex_unlock( &p_item->lock );<br> <br> return b_fetched;<br>@@ -485,9 +459,7 @@ void input_item_Release( input_item_t *p_item )<br> free( p_item->psz_name );<br> free( p_item->psz_uri );<br> free( p_item->p_stats );<br>-<br>- if( p_item->p_meta != NULL )<br>- vlc_meta_Delete( p_item->p_meta );<br>+ vlc_meta_Delete( p_item->p_meta );<br> <br> for( input_item_opaque_t *o = p_item->opaques, *next; o != NULL; o = next )<br> {<br>@@ -1062,6 +1034,13 @@ input_item_NewExt( const char *psz_uri, const char *psz_name,<br> input_item_t *p_input = &owner->item;<br> vlc_event_manager_t * p_em = &p_input->event_manager;<br> <br>+ p_input->p_meta = vlc_meta_New();<br>+ if( unlikely(p_input->p_meta == NULL) )<br>+ {<br>+ free(owner);<br>+ return NULL;<br>+ }<br>+<br> vlc_mutex_init( &p_input->lock );<br> <br> p_input->psz_name = NULL;<br>@@ -1086,7 +1065,6 @@ input_item_NewExt( const char *psz_uri, const char *psz_name,<br> TAB_INIT( p_input->i_categories, p_input->pp_categories );<br> TAB_INIT( p_input->i_es, p_input->es );<br> p_input->p_stats = NULL;<br>- p_input->p_meta = NULL;<br> TAB_INIT( p_input->i_epg, p_input->pp_epg );<br> TAB_INIT( p_input->i_slaves, p_input->pp_slaves );<br> <br>@@ -1103,9 +1081,7 @@ input_item_NewExt( const char *psz_uri, const char *psz_name,<br> <br> input_item_t *input_item_Copy( input_item_t *p_input )<br> {<br>- vlc_meta_t *meta = NULL;<br> input_item_t *item;<br>- bool b_net;<br> <br> vlc_mutex_lock( &p_input->lock );<br> <br>@@ -1118,13 +1094,8 @@ input_item_t *input_item_Copy( input_item_t *p_input )<br> return NULL;<br> }<br> <br>- if( p_input->p_meta != NULL )<br>- {<br>- meta = vlc_meta_New();<br>- if( likely(meta != NULL) )<br>- vlc_meta_Merge( meta, p_input->p_meta );<br>- }<br>- b_net = p_input->b_net;<br>+ vlc_meta_Merge( item->p_meta, p_input->p_meta );<br>+ item->b_net = p_input->b_net;<br> <br> if( p_input->i_slaves > 0 )<br> {<br>@@ -1145,8 +1116,6 @@ input_item_t *input_item_Copy( input_item_t *p_input )<br> <br> /* No need to lock; no other thread has seen this new item yet. */<br> input_item_CopyOptions( item, p_input );<br>- item->p_meta = meta;<br>- item->b_net = b_net;<br> return item;<br> }<br> <br>-- <br>2.28.0<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>