Changeset 7e501d16ee2d458990cf27ac7d332572c91df856

Show
Ignore:
Timestamp:
07/06/07 19:22:05 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1181236925 +0000
git-parent:

[19cc11fe0ed03ab20c1cc13cbc3c1020b574e31f]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1181236925 +0000
Message:
  • Avoid a bunch of dummy string copy
  • Use strdup() instead of asprintf("%s")
  • Fix format string (CDDB now owns your CD player)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/cdda.c

    re7a8394 r7e501d1  
    415415 
    416416    p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, VLC_FALSE ); 
    417     psz_name = strdup( "Audio CD" ); 
    418417    vlc_mutex_lock( &p_playlist->object_lock ); 
    419     playlist_ItemSetName( p_parent, psz_name ); 
     418    playlist_ItemSetName( p_parent, "Audio CD" ); 
    420419    vlc_mutex_unlock( &p_playlist->object_lock ); 
    421420    var_SetInteger( p_playlist, "item-change", p_parent->p_input->i_id ); 
    422     free( psz_name ); 
    423421 
    424422#ifdef HAVE_LIBCDDB 
     
    428426        if( cddb_disc_get_title( p_sys->p_disc ) ) 
    429427        { 
    430             asprintf( &psz_name, "%s", cddb_disc_get_title( p_sys->p_disc ) ); 
     428            const char *psz_name = cddb_disc_get_title( p_sys->p_disc ); 
    431429            vlc_mutex_lock( &p_playlist->object_lock ); 
    432430            playlist_ItemSetName( p_parent, psz_name ); 
     
    434432            var_SetInteger( p_playlist, "item-change", 
    435433                            p_parent->p_input->i_id ); 
    436             free( psz_name ); 
    437434        } 
    438435    } 
     
    485482                    input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT), 
    486483                                            _(VLC_META_TITLE), 
    487                                             cddb_track_get_title( t ) ); 
     484                                            "%s", cddb_track_get_title( t ) ); 
    488485                    if( p_input_item->psz_name ) 
    489486                        free( p_input_item->psz_name ); 
    490                     asprintf( &p_input_item->psz_name, "%s", 
    491                               cddb_track_get_title( t ) ); 
     487                    p_input_item->psz_name = strdup( cddb_track_get_title( t ) ); 
    492488                } 
    493489                psz_result = cddb_track_get_artist( t ); 
     
    495491                { 
    496492                    input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT), 
    497                                             _(VLC_META_ARTIST), psz_result ); 
     493                                       _(VLC_META_ARTIST), "%s", psz_result ); 
    498494                } 
    499495            }