Changeset 23d27c9c9cec127459721c3b9420eb349109b477
- Timestamp:
- 19/08/06 18:19:31
(2 years ago)
- Author:
- Clément Stenac <zorglub@videolan.org>
- git-committer:
- Clément Stenac <zorglub@videolan.org> 1156004371 +0000
- git-parent:
[2c2ebc9c31414a523710240e5ca6bc743057a42f]
- git-author:
- Clément Stenac <zorglub@videolan.org> 1156004371 +0000
- Message:
* B-search macro
* Redo dictionnary handling to remove recursion and bugs
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r093de85 |
r23d27c9 |
|
| 204 | 204 | typedef struct variable_t variable_t; |
|---|
| 205 | 205 | typedef struct date_t date_t; |
|---|
| 206 | | typedef struct hashtable_entry_t hashtable_entry_t; |
|---|
| | 206 | typedef struct dict_entry_t dict_entry_t; |
|---|
| | 207 | typedef struct dict_t dict_t; |
|---|
| 207 | 208 | typedef struct gc_object_t gc_object_t ; |
|---|
| 208 | 209 | |
|---|
| … | … | |
| 718 | 719 | } |
|---|
| 719 | 720 | |
|---|
| 720 | | /* Hash tables handling */ |
|---|
| 721 | | struct hashtable_entry_t |
|---|
| 722 | | { |
|---|
| 723 | | int i_id; |
|---|
| 724 | | char *psz_name; |
|---|
| | 721 | /* Binary search in an array */ |
|---|
| | 722 | #define BSEARCH( entries, count, elem, zetype, key, answer ) { \ |
|---|
| | 723 | int low = 0, high = count - 1; \ |
|---|
| | 724 | answer = -1; \ |
|---|
| | 725 | while( low <= high ) {\ |
|---|
| | 726 | int mid = (low + high ) / 2; /* Just don't care about 2^30 tables */ \ |
|---|
| | 727 | zetype mid_val = entries[mid] elem;\ |
|---|
| | 728 | if( mid_val < key ) \ |
|---|
| | 729 | low = mid + 1; \ |
|---|
| | 730 | else if ( mid_val > key ) \ |
|---|
| | 731 | high = mid -1; \ |
|---|
| | 732 | else \ |
|---|
| | 733 | { \ |
|---|
| | 734 | answer = mid; break; \ |
|---|
| | 735 | }\ |
|---|
| | 736 | } \ |
|---|
| | 737 | } |
|---|
| | 738 | |
|---|
| | 739 | /* Dictionnary handling */ |
|---|
| | 740 | struct dict_entry_t |
|---|
| | 741 | { |
|---|
| | 742 | int i_int; |
|---|
| | 743 | char *psz_string; |
|---|
| 725 | 744 | uint64_t i_hash; |
|---|
| 726 | 745 | void *p_data; |
|---|
| 727 | 746 | }; |
|---|
| 728 | 747 | |
|---|
| 729 | | VLC_EXPORT( void, vlc_HashInsert, (hashtable_entry_t **, int *, int, const char *, void *)); |
|---|
| 730 | | VLC_EXPORT( void*, vlc_HashRetrieve, (hashtable_entry_t*, int, int, const char *) ); |
|---|
| 731 | | VLC_EXPORT( int, vlc_HashLookup, (hashtable_entry_t *, int, int, const char *) ); |
|---|
| 732 | | |
|---|
| | 748 | struct dict_t |
|---|
| | 749 | { |
|---|
| | 750 | dict_entry_t *p_entries; |
|---|
| | 751 | int i_entries; |
|---|
| | 752 | }; |
|---|
| | 753 | |
|---|
| | 754 | VLC_EXPORT( dict_t *, vlc_DictNew, (void) ); |
|---|
| | 755 | VLC_EXPORT( void, vlc_DictClear, (dict_t * ) ); |
|---|
| | 756 | VLC_EXPORT( void, vlc_DictInsert, (dict_t *, int, const char *, void * ) ); |
|---|
| | 757 | VLC_EXPORT( void*, vlc_DictGet, (dict_t *, int, const char * ) ); |
|---|
| | 758 | VLC_EXPORT( int, vlc_DictLookup, (dict_t *, int, const char * ) ); |
|---|
| 733 | 759 | |
|---|
| 734 | 760 | /* MSB (big endian)/LSB (little endian) conversions - network order is always |
|---|
| re6e82bd |
r23d27c9 |
|
| 464 | 464 | update_t * (*__update_New_inner) (vlc_object_t *); |
|---|
| 465 | 465 | void (*update_download_inner) (update_iterator_t *, char *); |
|---|
| 466 | | void (*vlc_HashInsert_inner) (hashtable_entry_t **, int *, int, const char *, void *); |
|---|
| 467 | | int (*vlc_HashLookup_inner) (hashtable_entry_t *, int, int, const char *); |
|---|
| 468 | | void* (*vlc_HashRetrieve_inner) (hashtable_entry_t*, int, int, const char *); |
|---|
| | 466 | void *vlc_HashInsert_deprecated; |
|---|
| | 467 | void *vlc_HashLookup_deprecated; |
|---|
| | 468 | void *vlc_HashRetrieve_deprecated; |
|---|
| 469 | 469 | void * (*utf8_opendir_inner) (const char *dirname); |
|---|
| 470 | 470 | FILE * (*utf8_fopen_inner) (const char *filename, const char *mode); |
|---|
| … | … | |
| 526 | 526 | void (*__intf_ProgressUpdate_inner) (vlc_object_t*, int, const char*, float, int); |
|---|
| 527 | 527 | int (*playlist_AddInput_inner) (playlist_t *, input_item_t *,int , int, vlc_bool_t); |
|---|
| | 528 | void (*vlc_DictInsert_inner) (dict_t *, int, const char *, void *); |
|---|
| | 529 | void* (*vlc_DictGet_inner) (dict_t *, int, const char *); |
|---|
| | 530 | int (*vlc_DictLookup_inner) (dict_t *, int, const char *); |
|---|
| | 531 | void (*vlc_DictClear_inner) (dict_t *); |
|---|
| | 532 | dict_t * (*vlc_DictNew_inner) (void); |
|---|
| 528 | 533 | }; |
|---|
| 529 | 534 | # if defined (__PLUGIN__) |
|---|
| … | … | |
| 937 | 942 | # define __update_New (p_symbols)->__update_New_inner |
|---|
| 938 | 943 | # define update_download (p_symbols)->update_download_inner |
|---|
| 939 | | # define vlc_HashInsert (p_symbols)->vlc_HashInsert_inner |
|---|
| 940 | | # define vlc_HashLookup (p_symbols)->vlc_HashLookup_inner |
|---|
| 941 | | # define vlc_HashRetrieve (p_symbols)->vlc_HashRetrieve_inner |
|---|
| 942 | 944 | # define utf8_opendir (p_symbols)->utf8_opendir_inner |
|---|
| 943 | 945 | # define utf8_fopen (p_symbols)->utf8_fopen_inner |
|---|
| … | … | |
| 989 | 991 | # define __intf_ProgressUpdate (p_symbols)->__intf_ProgressUpdate_inner |
|---|
| 990 | 992 | # define playlist_AddInput (p_symbols)->playlist_AddInput_inner |
|---|
| | 993 | # define vlc_DictInsert (p_symbols)->vlc_DictInsert_inner |
|---|
| | 994 | # define vlc_DictGet (p_symbols)->vlc_DictGet_inner |
|---|
| | 995 | # define vlc_DictLookup (p_symbols)->vlc_DictLookup_inner |
|---|
| | 996 | # define vlc_DictClear (p_symbols)->vlc_DictClear_inner |
|---|
| | 997 | # define vlc_DictNew (p_symbols)->vlc_DictNew_inner |
|---|
| 991 | 998 | # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) |
|---|
| 992 | 999 | /****************************************************************** |
|---|
| … | … | |
| 1403 | 1410 | ((p_symbols)->__update_New_inner) = __update_New; \ |
|---|
| 1404 | 1411 | ((p_symbols)->update_download_inner) = update_download; \ |
|---|
| 1405 | | ((p_symbols)->vlc_HashInsert_inner) = vlc_HashInsert; \ |
|---|
| 1406 | | ((p_symbols)->vlc_HashLookup_inner) = vlc_HashLookup; \ |
|---|
| 1407 | | ((p_symbols)->vlc_HashRetrieve_inner) = vlc_HashRetrieve; \ |
|---|
| 1408 | 1412 | ((p_symbols)->utf8_opendir_inner) = utf8_opendir; \ |
|---|
| 1409 | 1413 | ((p_symbols)->utf8_fopen_inner) = utf8_fopen; \ |
|---|
| … | … | |
| 1455 | 1459 | ((p_symbols)->__intf_ProgressUpdate_inner) = __intf_ProgressUpdate; \ |
|---|
| 1456 | 1460 | ((p_symbols)->playlist_AddInput_inner) = playlist_AddInput; \ |
|---|
| | 1461 | ((p_symbols)->vlc_DictInsert_inner) = vlc_DictInsert; \ |
|---|
| | 1462 | ((p_symbols)->vlc_DictGet_inner) = vlc_DictGet; \ |
|---|
| | 1463 | ((p_symbols)->vlc_DictLookup_inner) = vlc_DictLookup; \ |
|---|
| | 1464 | ((p_symbols)->vlc_DictClear_inner) = vlc_DictClear; \ |
|---|
| | 1465 | ((p_symbols)->vlc_DictNew_inner) = vlc_DictNew; \ |
|---|
| 1457 | 1466 | (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ |
|---|
| 1458 | 1467 | (p_symbols)->__playlist_ItemNew_deprecated = NULL; \ |
|---|
| … | … | |
| 1490 | 1499 | (p_symbols)->stats_HandlerDestroy_deprecated = NULL; \ |
|---|
| 1491 | 1500 | (p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \ |
|---|
| | 1501 | (p_symbols)->vlc_HashInsert_deprecated = NULL; \ |
|---|
| | 1502 | (p_symbols)->vlc_HashLookup_deprecated = NULL; \ |
|---|
| | 1503 | (p_symbols)->vlc_HashRetrieve_deprecated = NULL; \ |
|---|
| 1492 | 1504 | (p_symbols)->playlist_ItemNewFromInput_deprecated = NULL; \ |
|---|
| 1493 | 1505 | (p_symbols)->playlist_PlaylistAdd_deprecated = NULL; \ |
|---|
| rba98f2b |
r23d27c9 |
|
| 326 | 326 | misc/vlm.c \ |
|---|
| 327 | 327 | misc/xml.c \ |
|---|
| 328 | | misc/hashtables.c \ |
|---|
| | 328 | misc/dict.c \ |
|---|
| 329 | 329 | misc/devices.c \ |
|---|
| 330 | 330 | extras/libc.c \ |
|---|
| r4acd4d4 |
r23d27c9 |
|
| 71 | 71 | { |
|---|
| 72 | 72 | vlc_object_t *p_obj = (vlc_object_t *)p_this->p_destructor_arg; |
|---|
| 73 | | int i, i_top, i_bottom; |
|---|
| | 73 | int i; |
|---|
| 74 | 74 | input_item_t *p_input = (input_item_t *) p_this; |
|---|
| 75 | 75 | |
|---|