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
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
Show 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 @@
* void *vlc_memalign( size_t align, size_t size, void **pp_orig )
* *pp_orig is the pointer that has to be freed afterwards.
*/
#if 0
#ifdef HAVE_POSIX_MEMALIGN
# define vlc_memalign(align,size,pp_orig) \
( !posix_memalign( pp_orig, align, size ) ? *(pp_orig) : NULL )
#endif
#endif
#ifdef HAVE_MEMALIGN
/* Some systems have memalign() but no declaration for it */
void
*
memalign
(
size_t
align
,
size_t
size
);
# define vlc_memalign(pp_orig,align,size) \
( *(pp_orig) = memalign( align, size ) )
#if defined (HAVE_POSIX_MEMALIGN)
static
inline
void
*
vlc_memalign
(
size_t
align
,
size_t
size
,
void
**
pp
)
{
return
posix_memalign
(
pp
,
align
,
size
)
?
NULL
:
*
pp
;
}
#elif defined (HAVE_MEMALIGN)
static
inline
void
*
vlc_memalign
(
size_t
align
,
size_t
size
,
void
**
pp
)
{
return
*
pp
=
memalign
(
align
,
size
);
}
#else
/* We don't have any choice but to align manually */
# define vlc_memalign(pp_orig,align,size) \
(( *(pp_orig) = malloc( size + align - 1 )) \
? (void *)( (((unsigned long)*(pp_orig)) + (unsigned long)(align-1) ) \
& (~(unsigned long)(align-1)) ) \
: NULL )
static
inline
void
*
vlc_memalign
(
size_t
align
,
size_t
size
,
void
**
pp
)
{
unsigned
char
*
ptr
;
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
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