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
254e16a8
Commit
254e16a8
authored
Nov 06, 2009
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allocate aligned memory for block_sys_t
parent
67f66f79
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/misc/block.c
src/misc/block.c
+8
-3
No files found.
src/misc/block.c
View file @
254e16a8
...
...
@@ -86,13 +86,18 @@ block_t *block_Alloc( size_t i_size )
{
/* We do only one malloc
* TODO: bench if doing 2 malloc but keeping a pool of buffer is better
* TODO: use memalign
* 16 -> align on 16
* 2 * BLOCK_PADDING_SIZE -> pre + post padding
*/
const
size_t
i_alloc
=
i_size
+
2
*
BLOCK_PADDING_SIZE
+
BLOCK_ALIGN
;
block_sys_t
*
p_sys
=
malloc
(
sizeof
(
*
p_sys
)
+
i_alloc
);
block_sys_t
*
p_sys
;
#ifdef HAVE_POSIX_MEMALIGN
p_sys
=
posix_memalign
(
&
p_sys
,
BLOCK_ALIGN
,
sizeof
(
*
p_sys
)
+
i_alloc
)
?
NULL
:
p_sys
;
#elif HAVE_MEMALIGN
p_sys
=
memalign
(
BLOCK_ALIGIN
,
sizeof
(
*
p_sys
)
+
i_alloc
);
#else
p_sys
=
malloc
(
sizeof
(
*
p_sys
)
+
i_alloc
);
#endif
if
(
p_sys
==
NULL
)
return
NULL
;
...
...
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