[vlc-devel] [vlc-commits] playlist: remove constant playlist_NodeDelete() parameter

Steve Lhomme robux4 at gmail.com
Thu Nov 17 08:46:08 CET 2016


On Wed, Nov 16, 2016 at 7:08 PM, Rémi Denis-Courmont <git at videolan.org> wrote:
> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 16 19:04:42 2016 +0200| [cc67adbfdcf3d084a8b2860e58dea0d711f24010] | committer: Rémi Denis-Courmont
>
> playlist: remove constant playlist_NodeDelete() parameter
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cc67adbfdcf3d084a8b2860e58dea0d711f24010
> ---
>
>  include/vlc_playlist.h                |  2 +-
>  modules/control/dbus/dbus_tracklist.c |  2 +-
>  modules/gui/ncurses.c                 |  2 +-
>  modules/gui/qt/dialogs_provider.cpp   |  2 +-
>  modules/gui/skins2/vars/playtree.cpp  |  2 +-
>  src/playlist/item.c                   |  6 +++---
>  src/playlist/services_discovery.c     |  6 +++---
>  src/playlist/tree.c                   | 11 ++++-------
>  8 files changed, 15 insertions(+), 18 deletions(-)
>
> diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
> index 0c583ff..a53f4d7 100644
> --- a/include/vlc_playlist.h
> +++ b/include/vlc_playlist.h
> @@ -353,7 +353,7 @@ VLC_API int playlist_LiveSearchUpdate(playlist_t *, playlist_item_t *, const cha
>  /* Node management */
>  VLC_API playlist_item_t * playlist_NodeCreate( playlist_t *, const char *, playlist_item_t * p_parent, int i_pos, int i_flags, input_item_t * );
>  VLC_API playlist_item_t * playlist_ChildSearchName(playlist_item_t*, const char* ) VLC_USED;
> -VLC_API void playlist_NodeDelete( playlist_t *, playlist_item_t *, bool , bool );
> +VLC_API void playlist_NodeDelete( playlist_t *, playlist_item_t *, bool );
>
>  /**************************
>   * Audio output management
> diff --git a/modules/control/dbus/dbus_tracklist.c b/modules/control/dbus/dbus_tracklist.c
> index 19ee8b9..8175595 100644
> --- a/modules/control/dbus/dbus_tracklist.c
> +++ b/modules/control/dbus/dbus_tracklist.c
> @@ -267,7 +267,7 @@ DBUS_METHOD( RemoveTrack )
>
>          if( item->i_id == i_id )
>          {
> -            playlist_NodeDelete( p_playlist, item, true, false );
> +            playlist_NodeDelete( p_playlist, item, false );
>              break;
>          }
>      }
> diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
> index fcb2933..c51307a 100644
> --- a/modules/gui/ncurses.c
> +++ b/modules/gui/ncurses.c
> @@ -1345,7 +1345,7 @@ static bool HandlePlaylistKey(intf_thread_t *intf, int key)
>          if (item->i_children == -1)
>              playlist_DeleteFromInput(p_playlist, item->p_input, pl_Locked);
>          else
> -            playlist_NodeDelete(p_playlist, item, true , false);
> +            playlist_NodeDelete(p_playlist, item, false);
>          PL_UNLOCK;
>          vlc_mutex_lock(&sys->pl_lock);
>          if (sys->box_idx >= sys->box_lines_total - 1)
> diff --git a/modules/gui/qt/dialogs_provider.cpp b/modules/gui/qt/dialogs_provider.cpp
> index 5951b65..f322b8c 100644
> --- a/modules/gui/qt/dialogs_provider.cpp
> +++ b/modules/gui/qt/dialogs_provider.cpp
> @@ -682,7 +682,7 @@ void DialogsProvider::saveRecentsToPlaylist()
>
>      saveAPlaylist(THEPL, p_node_recents);
>      playlist_Lock(THEPL);
> -    playlist_NodeDelete(THEPL, p_node_recents, true, false);
> +    playlist_NodeDelete(THEPL, p_node_recents, false);
>      playlist_Unlock(THEPL);
>  }
>
> diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
> index 74d516c..eb9518d 100644
> --- a/modules/gui/skins2/vars/playtree.cpp
> +++ b/modules/gui/skins2/vars/playtree.cpp
> @@ -66,7 +66,7 @@ void Playtree::delSelected()
>                  }
>                  else
>                  {
> -                    playlist_NodeDelete( m_pPlaylist, pItem, true, false );
> +                    playlist_NodeDelete( m_pPlaylist, pItem, false );
>                  }
>              }
>              playlist_Unlock( m_pPlaylist );
> diff --git a/src/playlist/item.c b/src/playlist/item.c
> index e3d1179..3e4f87a 100644
> --- a/src/playlist/item.c
> +++ b/src/playlist/item.c
> @@ -110,7 +110,7 @@ static void input_item_add_subitem_tree ( const vlc_event_t * p_event,
>          }
>          assert( i < p_parent->i_children );
>
> -        playlist_NodeDelete( p_playlist, p_item, true, false );
> +        playlist_NodeDelete( p_playlist, p_item, false );
>
>          /* If there is a pending request referring to the item we just deleted
>           * it needs to be updated so that we do not try to play an entity that
> @@ -329,7 +329,7 @@ static int DeleteFromInput( playlist_t *p_playlist, input_item_t *p_input,
>      playlist_item_t *p_item = playlist_ItemFindFromInputAndRoot(
>          p_playlist, p_input, p_root, false );
>      if( !p_item ) return VLC_EGENERIC;
> -    playlist_NodeDelete( p_playlist, p_item, true, false );
> +    playlist_NodeDelete( p_playlist, p_item, false );
>      return VLC_SUCCESS;
>  }
>
> @@ -401,7 +401,7 @@ int playlist_DeleteFromItemId( playlist_t *p_playlist, int i_id )
>      PL_ASSERT_LOCKED;
>      playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
>      if( !p_item ) return VLC_EGENERIC;
> -    playlist_NodeDelete( p_playlist, p_item, true, false );
> +    playlist_NodeDelete( p_playlist, p_item, false );
>      return VLC_SUCCESS;
>  }
>
> diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
> index 69de1f2..fc31c9a 100644
> --- a/src/playlist/services_discovery.c
> +++ b/src/playlist/services_discovery.c
> @@ -206,9 +206,9 @@ static void playlist_sd_item_removed(services_discovery_t *sd,
>      /* if the item was added under a category and the category node
>         becomes empty, delete that node as well */
>      if( p_parent->i_children > 1 || p_parent == p_sd_node )
> -        playlist_NodeDelete( p_playlist, p_item, true, false );
> +        playlist_NodeDelete( p_playlist, p_item, false );
>      else
> -        playlist_NodeDelete( p_playlist, p_parent, true, true );
> +        playlist_NodeDelete( p_playlist, p_parent, true );
>      PL_UNLOCK;
>  }
>
> @@ -259,7 +259,7 @@ static void playlist_ServicesDiscoveryInternalRemove(playlist_t *playlist,
>      /* Remove the sd playlist node if it exists */
>      playlist_Lock(playlist);
>      if (sds->node != NULL)
> -        playlist_NodeDelete(playlist, sds->node, true, false);
> +        playlist_NodeDelete(playlist, sds->node, false);
>      playlist_Unlock(playlist);
>
>      free(sds);
> diff --git a/src/playlist/tree.c b/src/playlist/tree.c
> index a2dbfdf..44078c2 100644
> --- a/src/playlist/tree.c
> +++ b/src/playlist/tree.c
> @@ -109,8 +109,7 @@ void playlist_NodeEmpty( playlist_t *p_playlist, playlist_item_t *p_root )
>      {
>          if( p_root->pp_children[i]->i_children > -1 )
>          {
> -            playlist_NodeDelete( p_playlist, p_root->pp_children[i],
> -                                 true, false );
> +            playlist_NodeDelete( p_playlist, p_root->pp_children[i], false );
>          }
>          else
>          {
> @@ -126,18 +125,16 @@ void playlist_NodeEmpty( playlist_t *p_playlist, playlist_item_t *p_root )
>   *
>   * \param p_playlist the playlist
>   * \param p_root the node
> - * \param b_delete_items do we have to delete the children items ?
>   */
>  void playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
> -                          bool b_delete_items, bool b_force )
> +                          bool b_force )
>  {
>      PL_ASSERT_LOCKED;
>
>      /* Delete the children */
>      for( int i = p_root->i_children - 1 ; i >= 0; i-- )
> -        if( b_delete_items || p_root->pp_children[i]->i_children >= 0 )
> -            playlist_NodeDelete( p_playlist, p_root->pp_children[i],
> -                                 b_delete_items, b_force );
> +        if( p_root->pp_children[i]->i_children >= 0 )
> +            playlist_NodeDelete( p_playlist, p_root->pp_children[i], b_force );

You removed a variable that was always true. So the if was always true
as well, it should go away. Now the behaviour is different than it was
before.

>      /* Delete the node */
>      if( p_root->i_flags & PLAYLIST_RO_FLAG && !b_force )
>
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits


More information about the vlc-devel mailing list