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
6b5383b1
Commit
6b5383b1
authored
Aug 18, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msg_VaGeneric: simplify error handling
parent
73b30f82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
31 deletions
+9
-31
src/misc/messages.c
src/misc/messages.c
+9
-31
No files found.
src/misc/messages.c
View file @
6b5383b1
...
...
@@ -255,7 +255,6 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
const
char
*
psz_module
,
const
char
*
psz_format
,
va_list
_args
)
{
char
*
psz_str
=
NULL
;
/* formatted message string */
va_list
args
;
assert
(
p_this
);
...
...
@@ -326,40 +325,17 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
#endif
/* Convert message to string */
static
const
char
nomemstr
[]
=
"<not enough memory to format message>"
;
char
*
str
;
vlc_va_copy
(
args
,
_args
);
if
(
vasprintf
(
&
psz_str
,
psz_format
,
args
)
==
-
1
)
psz_str
=
NULL
;
if
(
unlikely
(
vasprintf
(
&
str
,
psz_format
,
args
)
==
-
1
)
)
str
=
(
char
*
)
nomemstr
;
va_end
(
args
);
uselocale
(
locale
);
freelocale
(
c
);
if
(
unlikely
(
psz_str
==
NULL
))
{
int
canc
=
vlc_savecancel
();
/* Do not print half of a message... */
#ifdef __GLIBC__
fprintf
(
stderr
,
"main warning: can't store message (%m): "
);
#else
char
psz_err
[
1001
];
#ifndef WIN32
/* we're not using GLIBC, so we are sure that the error description
* will be stored in the buffer we provide to strerror_r() */
strerror_r
(
errno
,
psz_err
,
1001
);
#else
strncpy
(
psz_err
,
strerror
(
errno
),
1001
);
#endif
psz_err
[
1000
]
=
'\0'
;
fprintf
(
stderr
,
"main warning: can't store message (%s): "
,
psz_err
);
#endif
vlc_va_copy
(
args
,
_args
);
/* We should use utf8_vfprintf - but it calls malloc()... */
vfprintf
(
stderr
,
psz_format
,
args
);
va_end
(
args
);
fputs
(
"
\n
"
,
stderr
);
vlc_restorecancel
(
canc
);
return
;
}
/* Fill message information fields */
msg_item_t
msg
;
...
...
@@ -367,7 +343,7 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
msg
.
i_object_id
=
(
uintptr_t
)
p_this
;
msg
.
psz_object_type
=
p_this
->
psz_object_type
;
msg
.
psz_module
=
psz_module
;
msg
.
psz_msg
=
psz_
str
;
msg
.
psz_msg
=
str
;
msg
.
psz_header
=
NULL
;
for
(
vlc_object_t
*
o
=
p_this
;
o
!=
NULL
;
o
=
o
->
p_parent
)
...
...
@@ -413,7 +389,9 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
sub
->
func
(
sub
->
opaque
,
&
msg
);
}
vlc_rwlock_unlock
(
&
bank
->
lock
);
free
(
msg
.
psz_msg
);
if
(
likely
(
str
!=
(
char
*
)
nomemstr
))
free
(
str
);
}
/*****************************************************************************
...
...
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