[vlc-devel] commit: v4l2: compute strchr only one time. ( Rémi Duraffort )

git version control git at videolan.org
Fri Nov 20 15:34:40 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Nov 20 14:55:27 2009 +0100| [9922031c0bce2d30074cb0b1f6e708ac3d8a156d] | committer: Rémi Duraffort 

v4l2: compute strchr only one time.

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

 modules/access/v4l2.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/access/v4l2.c b/modules/access/v4l2.c
index ce496d1..a330819 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -719,9 +719,9 @@ static void GetV4L2Params( demux_sys_t *p_sys, vlc_object_t *p_obj )
     p_sys->psz_set_ctrls = var_CreateGetString( p_obj, "v4l2-set-ctrls" );
 
     char *psz_aspect = var_CreateGetString( p_obj, "v4l2-aspect-ratio" );
-    if( psz_aspect && *psz_aspect && strchr( psz_aspect, ':' ) )
+    char *psz_delim = !EMPTY_STR(psz_aspect) ? strchr( psz_aspect, ':' ) : NULL;
+    if( psz_delim )
     {
-        char *psz_delim = strchr( psz_aspect, ':' );
         p_sys->i_aspect = atoi( psz_aspect ) * VOUT_ASPECT_FACTOR / atoi( psz_delim + 1 );
     }
     else
@@ -2453,7 +2453,6 @@ static bool ProbeVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys,
     if( p_sys->dev_cap.capabilities & V4L2_CAP_HW_FREQ_SEEK )
         msg_Dbg( p_obj, "device supports hardware frequency seeking" );
 #endif
-
     if( p_sys->dev_cap.capabilities & V4L2_CAP_VBI_CAPTURE )
         msg_Dbg( p_obj, "device support raw VBI capture" );
 




More information about the vlc-devel mailing list