Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
12879a4c
Commit
12879a4c
authored
Nov 02, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MALLOC_(VOID|ERR). (and use calloc instead of malloc+memset)
parent
30b6a950
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
26 deletions
+31
-26
include/vlc_access.h
include/vlc_access.h
+17
-17
include/vlc_common.h
include/vlc_common.h
+0
-4
include/vlc_demux.h
include/vlc_demux.h
+2
-1
modules/control/hotkeys.c
modules/control/hotkeys.c
+3
-1
modules/demux/playlist/gvp.c
modules/demux/playlist/gvp.c
+3
-1
modules/misc/notify/msn.c
modules/misc/notify/msn.c
+3
-1
modules/misc/notify/telepathy.c
modules/misc/notify/telepathy.c
+3
-1
No files found.
include/vlc_access.h
View file @
12879a4c
...
...
@@ -153,18 +153,18 @@ static inline void access_InitFields( access_t *p_a )
p_access->pf_read = read; \
p_access->pf_block = block; \
p_access->pf_control = control; \
p_access->pf_seek = seek;
\
p_access->pf_seek = seek;
#define STANDARD_READ_ACCESS_INIT \
access_InitFields( p_access ); \
ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); \
MALLOC_ERR( p_access->p_sys, access_sys_t );
\
p_sys = p_access->p_sys; memset( p_sys, 0, sizeof( access_sys_t ) )
;
p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ));
\
if( !p_sys ) return VLC_ENOMEM
;
#define STANDARD_BLOCK_ACCESS_INIT \
access_InitFields( p_access ); \
ACCESS_SET_CALLBACKS( NULL, Block, Control, Seek ); \
MALLOC_ERR( p_access->p_sys, access_sys_t );
\
p_sys = p_access->p_sys; memset( p_sys, 0, sizeof( access_sys_t ) )
;
p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) );
\
if( !p_sys ) return VLC_ENOMEM
;
#endif
include/vlc_common.h
View file @
12879a4c
...
...
@@ -604,12 +604,8 @@ static inline uint8_t clip_uint8_vlc( int32_t a )
}
/* Malloc with automatic error */
#define MALLOC_VOID( var, type ) do { var = (type*)malloc( sizeof( type) ); \
if( !var ) return; } while(0)
#define MALLOC_NULL( var, type ) do { var = (type*)malloc( sizeof( type) ); \
if( !var ) return NULL; } while(0)
#define MALLOC_ERR( var, type ) do { var = (type*)malloc( sizeof( type) ); \
if( !var ) return VLC_ENOMEM; } while(0)
#define FREENULL(a) do { free( a ); a = NULL; } while(0)
...
...
include/vlc_demux.h
View file @
12879a4c
...
...
@@ -192,7 +192,8 @@ VLC_EXPORT( void, demux_PacketizerDestroy, ( decoder_t *p_packetizer ) );
#define DEMUX_INIT_COMMON() do { \
p_demux->pf_control = Control; \
p_demux->pf_demux = Demux; \
MALLOC_ERR( p_demux->p_sys, demux_sys_t ); \
p_demux->p_sys = malloc( sizeof( demux_sys_t ) ); \
if( !p_demux->p_sys ) return VLC_ENOMEM;\
memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) ); } while(0)
#define STANDARD_DEMUX_INIT_MSG( msg ) do { \
...
...
modules/control/hotkeys.c
View file @
12879a4c
...
...
@@ -109,7 +109,9 @@ static int Open( vlc_object_t *p_this )
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
;
MALLOC_ERR
(
p_sys
,
intf_sys_t
);
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
p_intf
->
p_sys
=
p_sys
;
p_intf
->
pf_run
=
Run
;
...
...
modules/demux/playlist/gvp.c
View file @
12879a4c
...
...
@@ -96,7 +96,9 @@ int Import_GVP( vlc_object_t *p_this )
STANDARD_DEMUX_INIT_MSG
(
"using Google Video Playlist (gvp) import"
);
p_demux
->
pf_control
=
Control
;
p_demux
->
pf_demux
=
Demux
;
MALLOC_ERR
(
p_demux
->
p_sys
,
demux_sys_t
);
p_demux
->
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
if
(
!
p_demux
->
p_sys
)
return
VLC_ENOMEM
;
return
VLC_SUCCESS
;
}
...
...
modules/misc/notify/msn.c
View file @
12879a4c
...
...
@@ -89,7 +89,9 @@ static int Open( vlc_object_t *p_this )
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
playlist_t
*
p_playlist
;
MALLOC_ERR
(
p_intf
->
p_sys
,
intf_sys_t
);
p_intf
->
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
!
p_intf
->
p_sys
)
return
VLC_ENOMEM
;
p_intf
->
p_sys
->
psz_format
=
config_GetPsz
(
p_intf
,
"msn-format"
);
if
(
!
p_intf
->
p_sys
->
psz_format
)
...
...
modules/misc/notify/telepathy.c
View file @
12879a4c
...
...
@@ -97,7 +97,9 @@ static int Open( vlc_object_t *p_this )
DBusConnection
*
p_conn
;
DBusError
error
;
MALLOC_ERR
(
p_intf
->
p_sys
,
intf_sys_t
);
p_intf
->
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
!
p_intf
->
p_sys
)
return
VLC_ENOMEM
;
/* connect to the session bus */
dbus_error_init
(
&
error
);
...
...
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