Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
c08fa1c2
Commit
c08fa1c2
authored
Oct 11, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include/vlc_arrays.h: Export a static inlined array API.
parent
c1012538
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
include/vlc_arrays.h
include/vlc_arrays.h
+69
-0
No files found.
include/vlc_arrays.h
View file @
c08fa1c2
...
@@ -117,6 +117,7 @@
...
@@ -117,6 +117,7 @@
} \
} \
} while(0)
} while(0)
#define TAB_REMOVE( count, tab, p ) \
#define TAB_REMOVE( count, tab, p ) \
do { \
do { \
int _i_index_; \
int _i_index_; \
...
@@ -278,6 +279,74 @@
...
@@ -278,6 +279,74 @@
#define FOREACH_END() } }
#define FOREACH_END() } }
/************************************************************************
* Dynamic arrays with progressive allocation (Prefered API)
************************************************************************/
typedef
struct
vlc_array_t
{
int
i_count
;
void
**
pp_elems
;
}
vlc_array_t
;
static
inline
void
vlc_array_init
(
vlc_array_t
*
p_array
)
{
memset
(
p_array
,
0
,
sizeof
(
vlc_array_t
)
);
}
static
inline
void
vlc_array_clear
(
vlc_array_t
*
p_array
)
{
free
(
p_array
->
pp_elems
);
memset
(
p_array
,
0
,
sizeof
(
vlc_array_t
)
);
}
/* Read */
static
inline
int
vlc_array_count
(
vlc_array_t
*
p_array
)
{
return
p_array
->
i_count
;
}
static
inline
void
*
vlc_array_object_at_index
(
vlc_array_t
*
p_array
,
int
i_index
)
{
return
p_array
->
pp_elems
[
i_index
];
}
/* Write */
static
inline
void
vlc_array_insert
(
vlc_array_t
*
p_array
,
void
*
p_elem
,
int
i_index
)
{
TAB_INSERT
(
p_array
->
i_count
,
p_array
->
pp_elems
,
p_elem
,
i_index
);
}
static
inline
void
vlc_array_append
(
vlc_array_t
*
p_array
,
void
*
p_elem
)
{
vlc_array_insert
(
p_array
,
p_elem
,
p_array
->
i_count
);
}
static
inline
void
vlc_array_remove
(
vlc_array_t
*
p_array
,
int
i_index
)
{
if
(
i_index
>=
0
)
{
if
(
p_array
->
i_count
>
1
)
{
memmove
(
p_array
->
pp_elems
+
i_index
,
p_array
->
pp_elems
+
i_index
+
1
,
(
p_array
->
i_count
-
i_index
-
1
)
*
sizeof
(
void
*
)
);
}
p_array
->
i_count
--
;
if
(
p_array
->
i_count
==
0
)
{
free
(
p_array
->
pp_elems
);
p_array
->
pp_elems
=
NULL
;
}
}
}
/************************************************************************
/************************************************************************
* Dictionaries
* Dictionaries
************************************************************************/
************************************************************************/
...
...
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