Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
ac91416b
Commit
ac91416b
authored
Jun 25, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
picture_pool: simplify allocation
parent
5f67e05b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
+9
-16
src/misc/picture_pool.c
src/misc/picture_pool.c
+9
-16
No files found.
src/misc/picture_pool.c
View file @
ac91416b
...
@@ -46,15 +46,14 @@ struct picture_gc_sys_t {
...
@@ -46,15 +46,14 @@ struct picture_gc_sys_t {
};
};
struct
picture_pool_t
{
struct
picture_pool_t
{
uint64_t
tick
;
uint64_t
tick
;
/* */
unsigned
picture_count
;
picture_t
**
picture
;
int
(
*
pic_lock
)(
picture_t
*
);
int
(
*
pic_lock
)(
picture_t
*
);
void
(
*
pic_unlock
)(
picture_t
*
);
void
(
*
pic_unlock
)(
picture_t
*
);
unsigned
refs
;
vlc_mutex_t
lock
;
vlc_mutex_t
lock
;
unsigned
refs
;
unsigned
picture_count
;
picture_t
*
picture
[];
};
};
void
picture_pool_Release
(
picture_pool_t
*
pool
)
void
picture_pool_Release
(
picture_pool_t
*
pool
)
...
@@ -79,7 +78,6 @@ void picture_pool_Release(picture_pool_t *pool)
...
@@ -79,7 +78,6 @@ void picture_pool_Release(picture_pool_t *pool)
}
}
vlc_mutex_destroy
(
&
pool
->
lock
);
vlc_mutex_destroy
(
&
pool
->
lock
);
free
(
pool
->
picture
);
free
(
pool
);
free
(
pool
);
}
}
...
@@ -134,22 +132,17 @@ static picture_t *picture_pool_ClonePicture(picture_pool_t *pool,
...
@@ -134,22 +132,17 @@ static picture_t *picture_pool_ClonePicture(picture_pool_t *pool,
picture_pool_t
*
picture_pool_NewExtended
(
const
picture_pool_configuration_t
*
cfg
)
picture_pool_t
*
picture_pool_NewExtended
(
const
picture_pool_configuration_t
*
cfg
)
{
{
picture_pool_t
*
pool
=
malloc
(
sizeof
(
*
pool
));
picture_pool_t
*
pool
=
malloc
(
sizeof
(
*
pool
)
+
cfg
->
picture_count
*
sizeof
(
picture_t
*
));
if
(
unlikely
(
pool
==
NULL
))
if
(
unlikely
(
pool
==
NULL
))
return
NULL
;
return
NULL
;
pool
->
tick
=
1
;
pool
->
tick
=
1
;
pool
->
picture_count
=
cfg
->
picture_count
;
pool
->
picture
=
calloc
(
pool
->
picture_count
,
sizeof
(
*
pool
->
picture
));
if
(
unlikely
(
pool
->
picture
==
NULL
))
{
free
(
pool
);
return
NULL
;
}
pool
->
refs
=
1
;
pool
->
pic_lock
=
cfg
->
lock
;
pool
->
pic_lock
=
cfg
->
lock
;
pool
->
pic_unlock
=
cfg
->
unlock
;
pool
->
pic_unlock
=
cfg
->
unlock
;
vlc_mutex_init
(
&
pool
->
lock
);
vlc_mutex_init
(
&
pool
->
lock
);
pool
->
refs
=
1
;
pool
->
picture_count
=
cfg
->
picture_count
;
for
(
unsigned
i
=
0
;
i
<
cfg
->
picture_count
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
cfg
->
picture_count
;
i
++
)
{
picture_t
*
picture
=
picture_pool_ClonePicture
(
pool
,
cfg
->
picture
[
i
]);
picture_t
*
picture
=
picture_pool_ClonePicture
(
pool
,
cfg
->
picture
[
i
]);
...
...
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