[vlc-commits] XCB: avoid strndup() for debug messages
Rémi Denis-Courmont
git at videolan.org
Sat May 4 06:14:09 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 4 07:12:19 2013 +0300| [a647be18fe3b519cd525d25f218ce434fdc2af82] | committer: Rémi Denis-Courmont
XCB: avoid strndup() for debug messages
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a647be18fe3b519cd525d25f218ce434fdc2af82
---
modules/video_output/xcb/events.c | 8 ++------
modules/video_output/xcb/xvideo.c | 9 ++-------
2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/modules/video_output/xcb/events.c b/modules/video_output/xcb/events.c
index 797fdcf..4a51779 100644
--- a/modules/video_output/xcb/events.c
+++ b/modules/video_output/xcb/events.c
@@ -72,12 +72,8 @@ static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
const xcb_setup_t *setup = xcb_get_setup (conn);
msg_Dbg (obj, "connected to X%"PRIu16".%"PRIu16" server",
setup->protocol_major_version, setup->protocol_minor_version);
- char *vendor = strndup (xcb_setup_vendor (setup), setup->vendor_len);
- if (vendor)
- {
- msg_Dbg (obj, " vendor : %s", vendor);
- free (vendor);
- }
+ msg_Dbg (obj, " vendor : %.*s", (int)setup->vendor_len,
+ xcb_setup_vendor (setup));
msg_Dbg (obj, " version: %"PRIu32, setup->release_number);
return conn;
}
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index eabf068..4154933 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -428,7 +428,6 @@ static int Open (vlc_object_t *obj)
xcb_xv_adaptor_info_next (&it))
{
const xcb_xv_adaptor_info_t *a = it.data;
- char *name;
adaptor_current++;
if (adaptor_selected != -1 && adaptor_selected != adaptor_current)
@@ -466,12 +465,8 @@ static int Open (vlc_object_t *obj)
grabbed_port:
/* Found port - initialize selected format */
- name = strndup (xcb_xv_adaptor_info_name (a), a->name_size);
- if (name != NULL)
- {
- msg_Dbg (vd, "using adaptor %s", name);
- free (name);
- }
+ msg_Dbg (vd, "using adaptor %.*s", (int)a->name_size,
+ xcb_xv_adaptor_info_name (a));
msg_Dbg (vd, "using port %"PRIu32, p_sys->port);
msg_Dbg (vd, "using image format 0x%"PRIx32, p_sys->id);
More information about the vlc-commits
mailing list