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
b6366fc0
Commit
b6366fc0
authored
Nov 02, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MALLOC_NULL and use calloc when needed.
parent
12879a4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
include/vlc_common.h
include/vlc_common.h
+1
-4
src/input/input.c
src/input/input.c
+3
-2
src/misc/messages.c
src/misc/messages.c
+3
-1
No files found.
include/vlc_common.h
View file @
b6366fc0
...
@@ -603,10 +603,7 @@ static inline uint8_t clip_uint8_vlc( int32_t a )
...
@@ -603,10 +603,7 @@ static inline uint8_t clip_uint8_vlc( int32_t a )
else
return
a
;
else
return
a
;
}
}
/* Malloc with automatic error */
/* Free and set set the variable to NULL */
#define MALLOC_NULL( var, type ) do { var = (type*)malloc( sizeof( type) ); \
if( !var ) return NULL; } while(0)
#define FREENULL(a) do { free( a ); a = NULL; } while(0)
#define FREENULL(a) do { free( a ); a = NULL; } while(0)
#define EMPTY_STR(str) (!str || !*str)
#define EMPTY_STR(str) (!str || !*str)
...
...
src/input/input.c
View file @
b6366fc0
...
@@ -161,8 +161,9 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
...
@@ -161,8 +161,9 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
stats_TimerStart
(
p_input
,
psz_timer_name
,
stats_TimerStart
(
p_input
,
psz_timer_name
,
STATS_TIMER_INPUT_LAUNCHING
);
STATS_TIMER_INPUT_LAUNCHING
);
MALLOC_NULL
(
p_input
->
p
,
input_thread_private_t
);
p_input
->
p
=
calloc
(
1
,
sizeof
(
input_thread_private_t
)
);
memset
(
p_input
->
p
,
0
,
sizeof
(
input_thread_private_t
)
);
if
(
!
p_input
->
p
)
return
NULL
;
/* One "randomly" selected input thread is responsible for computing
/* One "randomly" selected input thread is responsible for computing
* the global stats. Check if there is already someone doing this */
* the global stats. Check if there is already someone doing this */
...
...
src/misc/messages.c
View file @
b6366fc0
...
@@ -595,7 +595,9 @@ static msg_context_t* GetContext(void)
...
@@ -595,7 +595,9 @@ static msg_context_t* GetContext(void)
msg_context_t
*
p_ctx
=
vlc_threadvar_get
(
&
msg_context
);
msg_context_t
*
p_ctx
=
vlc_threadvar_get
(
&
msg_context
);
if
(
p_ctx
==
NULL
)
if
(
p_ctx
==
NULL
)
{
{
MALLOC_NULL
(
p_ctx
,
msg_context_t
);
p_ctx
=
malloc
(
sizeof
(
msg_context_t
)
);
if
(
!
p_ctx
)
return
NULL
;
p_ctx
->
psz_message
=
NULL
;
p_ctx
->
psz_message
=
NULL
;
vlc_threadvar_set
(
&
msg_context
,
p_ctx
);
vlc_threadvar_set
(
&
msg_context
,
p_ctx
);
}
}
...
...
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