diff options
author | Rodeo <[email protected]> | 2012-03-29 13:25:24 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-03-29 13:25:24 +0000 |
commit | 5cfc8521de5547646afd47b46c8565dac351c50d (patch) | |
tree | 9492d8dcb3eed2559f456ec6ded7e2f7dce4e5d9 /libhb/hb_dict.c | |
parent | 39425d02862f054e3ef87ef45b789254c64511ad (diff) |
hb_dict: minor improvements.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4553 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/hb_dict.c')
-rw-r--r-- | libhb/hb_dict.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libhb/hb_dict.c b/libhb/hb_dict.c index 5d54d8b4e..11206920c 100644 --- a/libhb/hb_dict.c +++ b/libhb/hb_dict.c @@ -41,16 +41,13 @@ void hb_dict_free( hb_dict_t ** dict_ptr ) if( dict->objects[i].key ) { free( dict->objects[i].key ); - dict->objects[i].key = NULL; } if( dict->objects[i].value ) { free( dict->objects[i].value ); - dict->objects[i].value = NULL; } } free( dict->objects ); - dict->objects = NULL; } free( *dict_ptr ); *dict_ptr = NULL; @@ -129,10 +126,9 @@ hb_dict_entry_t * hb_dict_next( hb_dict_t * dict, hb_dict_entry_t * previous ) return NULL; if( !previous ) return &dict->objects[0]; - int i; - for( i = 0; i+1 < dict->count; i++ ) - if( &dict->objects[i] == previous ) - return &dict->objects[i+1]; + unsigned int prev_index = previous - dict->objects; + if( prev_index + 1 < dict->count ) + return &dict->objects[prev_index+1]; return NULL; } |