[vlc-devel] commit: LUA: fix busy loop with "luahttp" and "luarc" shortcuts ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Jan 24 20:21:51 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 24 21:21:24 2010 +0200| [02bffa9fef9f7842458998a831a44c505f32ee3f] | committer: Rémi Denis-Courmont 

LUA: fix busy loop with "luahttp" and "luarc" shortcuts

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

 modules/misc/lua/intf.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/modules/misc/lua/intf.c b/modules/misc/lua/intf.c
index 3074355..304c657 100644
--- a/modules/misc/lua/intf.c
+++ b/modules/misc/lua/intf.c
@@ -110,16 +110,13 @@ static const struct
 
 static const char *WordInList( const char *psz_list, const char *psz_word )
 {
-    const char *psz_str = strstr( psz_list, psz_word );
-    int i_len = strlen( psz_word );
-    while( psz_str )
+    size_t i_len = strlen( psz_word );
+
+    for( const char *s = psz_list; s; s = strchr( s, ',' ) )
     {
-        if( (psz_str == psz_list || *(psz_str-1) == ',' )
-         /* it doesn't start in middle of a word */
-         /* it doest end in middle of a word */
-         && ( psz_str[i_len] == '\0' || psz_str[i_len] == ',' ) )
-            return psz_str;
-        psz_str = strstr( psz_str, psz_word );
+        if( !strncmp( s, psz_word, i_len )
+         && memchr( ",", s[i_len], 2 ) )
+            return s;
     }
     return NULL;
 }




More information about the vlc-devel mailing list