Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
1855d4a8
Commit
1855d4a8
authored
Aug 13, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include/vlc_arrays.h: Allow zero sized vlc_dictionary_t creation.
parent
5c47e150
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
include/vlc_arrays.h
include/vlc_arrays.h
+18
-4
No files found.
include/vlc_arrays.h
View file @
1855d4a8
...
...
@@ -318,9 +318,14 @@ static void * const kVLCDictionaryNotFound = NULL;
static
inline
void
vlc_dictionary_init
(
vlc_dictionary_t
*
p_dict
,
int
i_size
)
{
p_dict
->
p_entries
=
(
struct
vlc_dictionary_entry_t
**
)
malloc
(
sizeof
(
struct
vlc_dictionary_entry_t
*
)
*
i_size
);
assert
(
p_dict
->
p_entries
);
memset
(
p_dict
->
p_entries
,
0
,
sizeof
(
struct
vlc_dictionary_entry_t
*
)
*
i_size
);
if
(
i_size
>
0
)
{
p_dict
->
p_entries
=
(
struct
vlc_dictionary_entry_t
**
)
malloc
(
sizeof
(
struct
vlc_dictionary_entry_t
*
)
*
i_size
);
assert
(
p_dict
->
p_entries
);
memset
(
p_dict
->
p_entries
,
0
,
sizeof
(
struct
vlc_dictionary_entry_t
*
)
*
i_size
);
}
else
p_dict
->
p_entries
=
NULL
;
p_dict
->
i_size
=
i_size
;
}
...
...
@@ -348,6 +353,9 @@ static inline void vlc_dictionary_clear( vlc_dictionary_t * p_dict )
static
inline
void
*
vlc_dictionary_value_for_key
(
const
vlc_dictionary_t
*
p_dict
,
const
char
*
psz_key
)
{
if
(
!
p_dict
->
p_entries
)
return
kVLCDictionaryNotFound
;
int
i_pos
=
DictHash
(
psz_key
,
p_dict
->
i_size
);
struct
vlc_dictionary_entry_t
*
p_entry
=
p_dict
->
p_entries
[
i_pos
];
...
...
@@ -406,6 +414,9 @@ static inline void
__vlc_dictionary_insert
(
vlc_dictionary_t
*
p_dict
,
const
char
*
psz_key
,
void
*
p_value
,
vlc_bool_t
rebuild
)
{
if
(
!
p_dict
->
p_entries
)
vlc_dictionary_init
(
p_dict
,
1
);
int
i_pos
=
DictHash
(
psz_key
,
p_dict
->
i_size
);
struct
vlc_dictionary_entry_t
*
p_entry
=
p_dict
->
p_entries
[
i_pos
];
...
...
@@ -446,7 +457,7 @@ __vlc_dictionary_insert( vlc_dictionary_t * p_dict, const char * psz_key,
{
/* Here it starts to be not good, rebuild a bigger dictionary */
struct
vlc_dictionary_t
new_dict
;
int
i_new_size
=
(
p_dict
->
i_size
*
3
)
/
2
;
/* XXX: this need tuning */
int
i_new_size
=
(
(
p_dict
->
i_size
+
2
)
*
3
)
/
2
;
/* XXX: this need tuning */
int
i
;
vlc_dictionary_init
(
&
new_dict
,
i_new_size
);
...
...
@@ -477,6 +488,9 @@ vlc_dictionary_insert( vlc_dictionary_t * p_dict, const char * psz_key, void * p
static
inline
void
vlc_dictionary_remove_value_for_key
(
const
vlc_dictionary_t
*
p_dict
,
const
char
*
psz_key
)
{
if
(
!
p_dict
->
p_entries
)
return
;
int
i_pos
=
DictHash
(
psz_key
,
p_dict
->
i_size
);
struct
vlc_dictionary_entry_t
*
p_entry
=
p_dict
->
p_entries
[
i_pos
];
struct
vlc_dictionary_entry_t
*
p_prev
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment