[vlc-devel] [PATCH 06/11] playlist/item: playlist_ItemGetBy{Id, Input}: simplify
Filip Roséen
filip at atch.se
Thu May 18 12:01:13 CEST 2017
Variables declared, initialized, but then only read once has been
replaced by the equivalent values.
---
src/playlist/item.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/playlist/item.c b/src/playlist/item.c
index e93e38e143..4739252007 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -363,12 +363,11 @@ void playlist_ItemRelease( playlist_t *p_playlist, playlist_item_t *p_item )
*/
playlist_item_t *playlist_ItemGetById( playlist_t *p_playlist , int id )
{
- playlist_private_t *p = pl_priv(p_playlist);
- playlist_item_t key, **pp;
-
PL_ASSERT_LOCKED;
- key.i_id = id;
- pp = tfind( &key, &p->id_tree, playlist_ItemCmpId );
+
+ playlist_item_t **pp = tfind( &(playlist_item_t){ .i_id = id },
+ &pl_priv(p_playlist)->id_tree, playlist_ItemCmpId );
+
return (pp != NULL) ? *pp : NULL;
}
@@ -387,12 +386,11 @@ playlist_item_t *playlist_ItemGetById( playlist_t *p_playlist , int id )
playlist_item_t *playlist_ItemGetByInput( playlist_t * p_playlist,
const input_item_t *item )
{
- playlist_private_t *p = pl_priv(p_playlist);
- playlist_item_t key, **pp;
-
PL_ASSERT_LOCKED;
- key.p_input = (input_item_t *)item;
- pp = tfind( &key, &p->input_tree, playlist_ItemCmpInput );
+
+ playlist_item_t **pp = tfind( &(playlist_item_t){ .p_input = (void*)item },
+ &pl_priv(p_playlist)->input_tree, playlist_ItemCmpInput );
+
return (pp != NULL) ? *pp : NULL;
}
--
2.12.2
More information about the vlc-devel
mailing list