[vlc-commits] Use strspn() and constify

Rémi Denis-Courmont git at videolan.org
Thu Jan 20 22:24:56 CET 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jan 20 20:50:17 2011 +0200| [d4546731ef1b5bf92890986ec5a29ffe5c147024] | committer: Rémi Denis-Courmont

Use strspn() and constify

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

 modules/demux/playlist/b4s.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/modules/demux/playlist/b4s.c b/modules/demux/playlist/b4s.c
index 7d32e60..c2e69e5 100644
--- a/modules/demux/playlist/b4s.c
+++ b/modules/demux/playlist/b4s.c
@@ -44,7 +44,7 @@ struct demux_sys_t
  *****************************************************************************/
 static int Demux( demux_t *p_demux);
 static int Control( demux_t *p_demux, int i_query, va_list args );
-static int IsWhitespace( char *psz_string );
+static bool IsWhitespace( const char *psz_string );
 
 /*****************************************************************************
  * Import_B4S: main import function
@@ -281,16 +281,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     return VLC_EGENERIC;
 }
 
-static int IsWhitespace( char *psz_string )
+static bool IsWhitespace( const char *psz_string )
 {
-    while( *psz_string )
-    {
-        if( *psz_string != ' ' && *psz_string != '\t' && *psz_string != '\r' &&
-            *psz_string != '\n' )
-        {
-            return false;
-        }
-        psz_string++;
-    }
-    return true;
+    psz_string += strspn( psz_string, " \t\r\n" );
+    return !*psz_string;
 }



More information about the vlc-commits mailing list