Changeset 536386869cf05eedbd716c9c17a1b67204b0ef1f

Show
Ignore:
Timestamp:
02/13/08 23:09:00 (7 months ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1202940540 +0000
git-parent:

[eef8d9d4ebb1c91b863bc3046037ff5e7a04e09e]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1202940540 +0000
Message:

vlc_arrays.h: More vlc_dictionary_t fixes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_arrays.h

    r755df9f r5363868  
    432432    int i; 
    433433    struct vlc_dictionary_entry_t * p_current, * p_next; 
    434     for( i = 0; i < p_dict->i_size; i++ ) 
    435     { 
    436         p_current = p_dict->p_entries[i]; 
    437         while( p_current ) 
     434    if( p_dict->p_entries ) 
     435    { 
     436        for( i = 0; i < p_dict->i_size; i++ ) 
    438437        { 
    439             p_next = p_dict->p_entries[i]->p_next; 
    440             free( p_dict->p_entries[i]->psz_key ); 
    441             free( p_current ); 
    442             p_current = p_next; 
     438            p_current = p_dict->p_entries[i]; 
     439            while( p_current ) 
     440            { 
     441                p_next = p_dict->p_entries[i]->p_next; 
     442                free( p_dict->p_entries[i]->psz_key ); 
     443                free( p_current ); 
     444                p_current = p_next; 
     445            } 
    443446        } 
    444     } 
    445     free( p_dict->p_entries ); 
     447        free( p_dict->p_entries ); 
     448    } 
    446449    p_dict->i_size = 0; 
    447450} 
     
    461464        return kVLCDictionaryNotFound; 
    462465 
    463     /* Make sure we return the right item. (Hash collision)  */ 
     466    if( p_entry && !p_entry->p_next ) 
     467        return p_entry->p_value; 
     468 
     469    /* Make sure we return the right item. (Hash collision) */ 
    464470    do { 
    465471        if( !strcmp( psz_key, p_entry->psz_key ) ) 
     
    476482    struct vlc_dictionary_entry_t * p_entry; 
    477483    int i, count = 0; 
     484 
     485    if( !p_dict->p_entries ) 
     486        return 0; 
     487 
    478488    for( i = 0; i < p_dict->i_size; i++ ) 
    479489    { 
     
    570580            vlc_dictionary_clear( p_dict ); 
    571581            p_dict->i_size = new_dict.i_size; 
    572             p_dict->p_entries= new_dict.p_entries; 
     582            p_dict->p_entries = new_dict.p_entries; 
    573583        } 
    574584    }