From 917dc2d466079e8ab1b5db0f63568fd0038b0a3c Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 4 May 2013 07:12:19 +0300 Subject: [PATCH] XCB: avoid strndup() for debug messages --- 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 797fdcf69e..4a51779219 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 eabf068739..4154933e73 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); -- 2.39.5