vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat May  4 
07:12:19 2013 +0300| [917dc2d466079e8ab1b5db0f63568fd0038b0a3c] | committer: 
Rémi Denis-Courmont

XCB: avoid strndup() for debug messages

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=917dc2d466079e8ab1b5db0f63568fd0038b0a3c
---

 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);
 

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to