[vlc-commits] input/control: remove unnecessar memory allocation

Filip Roséen git at videolan.org
Fri Mar 3 16:01:15 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu Mar  2 17:32:25 2017 +0100| [9f4b1a474d4ae229b11d2ef3044a8609ef000f25] | committer: Jean-Baptiste Kempf

input/control: remove unnecessar memory allocation

Hi `vlc-devel`,

On 2017-03-01 09:52, Filip Roséen wrote:

> diff --git a/src/input/control.c b/src/input/control.c
> index f4781eb1a5..ff6df4c2fe 100644
> --- a/src/input/control.c
> +++ b/src/input/control.c
> @@ -399,7 +399,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
>                  return VLC_EGENERIC;
>              }
>
> -            input_title_t *p_title = vlc_input_title_Duplicate( priv->title[*pi_title_to_fetch] );
> +            input_title_t *p_title = priv->title[*pi_title_to_fetch];

I just noticed that this patch results in a warning due to
`input_thread_private_t::title` being *const-qualified*, and `p_title`
lacking such qualifier.

See attached patch for a fixup of [`d1feba6`][1].

Best Regards,\
Filip

[1]: http://git.videolan.org/?p=vlc.git;a=commit;h=d1feba6e5f90e48e41cc507ab574f3a1091047f5

>From dc5e79e1c83075522e1ef21318ea807a3946d5f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Ros=C3=A9en?= <filip at atch.se>
Date: Thu, 2 Mar 2017 16:39:38 +0100
Subject: [PATCH] input/control: INPUT_GET_SEEKPOINTS: apply const to silence
 warning

priv->title[n] results in a pointer-to-const, which means that the
initialization of p_title discards the const qualifier; this addition
fixes that warning while also making the implementation more correct.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/input/control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input/control.c b/src/input/control.c
index 860ff24..a50e25b 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -399,7 +399,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
                 return VLC_EGENERIC;
             }
 
-            input_title_t *p_title = priv->title[*pi_title_to_fetch];
+            const input_title_t *p_title = priv->title[*pi_title_to_fetch];
 
             /* set arg2 to the number of seekpoints we found */
             const int i_chapters = p_title->i_seekpoint;



More information about the vlc-commits mailing list