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
08606c71
Commit
08606c71
authored
Jan 31, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Use posix_memalign when available.
- Use inlines for expansion safety.
parent
88e2bbba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
19 deletions
+29
-19
src/video_output/vout_pictures.h
src/video_output/vout_pictures.h
+29
-19
No files found.
src/video_output/vout_pictures.h
View file @
08606c71
...
@@ -109,25 +109,35 @@
...
@@ -109,25 +109,35 @@
* void *vlc_memalign( size_t align, size_t size, void **pp_orig )
* void *vlc_memalign( size_t align, size_t size, void **pp_orig )
* *pp_orig is the pointer that has to be freed afterwards.
* *pp_orig is the pointer that has to be freed afterwards.
*/
*/
#if 0
#if defined (HAVE_POSIX_MEMALIGN)
#ifdef HAVE_POSIX_MEMALIGN
static
inline
# define vlc_memalign(align,size,pp_orig) \
void
*
vlc_memalign
(
size_t
align
,
size_t
size
,
void
**
pp
)
( !posix_memalign( pp_orig, align, size ) ? *(pp_orig) : NULL )
{
#endif
return
posix_memalign
(
pp
,
align
,
size
)
?
NULL
:
*
pp
;
#endif
}
#ifdef HAVE_MEMALIGN
#elif defined (HAVE_MEMALIGN)
/* Some systems have memalign() but no declaration for it */
static
inline
void
*
memalign
(
size_t
align
,
size_t
size
);
void
*
vlc_memalign
(
size_t
align
,
size_t
size
,
void
**
pp
)
{
# define vlc_memalign(pp_orig,align,size) \
return
*
pp
=
memalign
(
align
,
size
);
( *(pp_orig) = memalign( align, size ) )
}
#else
/* We don't have any choice but to align manually */
#else
/* We don't have any choice but to align manually */
# define vlc_memalign(pp_orig,align,size) \
static
inline
(( *(pp_orig) = malloc( size + align - 1 )) \
void
*
vlc_memalign
(
size_t
align
,
size_t
size
,
void
**
pp
)
? (void *)( (((unsigned long)*(pp_orig)) + (unsigned long)(align-1) ) \
{
& (~(unsigned long)(align-1)) ) \
unsigned
char
*
ptr
;
: NULL )
if
(
align
<
1
)
return
NULL
;
align
--
;
ptr
=
malloc
(
size
+
--
align
);
if
(
ptr
==
NULL
)
return
NULL
;
*
pp
=
ptr
;
ptr
+=
align
;
return
(
void
*
)(((
uintptr_t
)
ptr
)
&
~
align
);
}
#endif
#endif
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