[vlc-commits] commit: LUA: (really) fix infinite loop ( Rémi Denis-Courmont )
git at videolan.org
git at videolan.org
Sun Mar 7 16:11:01 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar 7 17:02:44 2010 +0200| [fb3c1a2898afb16be0f9833ffc5b2662060825a0] | committer: Rémi Denis-Courmont
LUA: (really) fix infinite loop
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb3c1a2898afb16be0f9833ffc5b2662060825a0
---
modules/misc/lua/intf.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/modules/misc/lua/intf.c b/modules/misc/lua/intf.c
index 23943fe..103126f 100644
--- a/modules/misc/lua/intf.c
+++ b/modules/misc/lua/intf.c
@@ -83,15 +83,17 @@ static const struct
static const char *WordInList( const char *psz_list, const char *psz_word )
{
- size_t i_len = strlen( psz_word );
-
- for( const char *s = psz_list; s; s = strchr( s, ',' ) )
+ for( ;; )
{
- if( !strncmp( s, psz_word, i_len )
- && memchr( ",", s[i_len], 2 ) )
- return s;
+ const char *end = strchr( psz_list, ',' );
+ if( end == NULL )
+ break;
+
+ if( !strncmp( psz_list, psz_word, end - psz_list ) )
+ return psz_list;
+ psz_list = end + 1;
}
- return NULL;
+ return strcmp( psz_list, psz_word ) ? psz_list : NULL;
}
static char *GetModuleName( intf_thread_t *p_intf )
More information about the vlc-commits
mailing list