changeset 24444:7c07a4b2aab0

Simplify ty_extensionis
author reimar
date Fri, 14 Sep 2007 15:28:47 +0000
parents 96dc3e753182
children e3b5a74a76f5
files libmpdemux/demux_ty.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ty.c	Fri Sep 14 15:19:45 2007 +0000
+++ b/libmpdemux/demux_ty.c	Fri Sep 14 15:28:47 2007 +0000
@@ -123,15 +123,12 @@
 #define TMF_SIG "showing.xml"
 
 // ===========================================================================
-static int ty_extensionis( char *name, char *ext )
+static int ty_extensionis(const char *name, const char *ext )
 {
-   char *ptr;
-
-   if ( strlen( ext ) > strlen( name ) ) return( 0 );
-   ptr = name;
-   ptr += ( strlen( name ) - strlen( ext ) );
-   if ( strcmp( ptr, ext ) == 0 ) return( 1 );
-   return( 0 );
+   int delta = strlen(name) - strlen(ext);
+   if (delta < 0) return 0;
+   name += delta;
+   return strcmp(name, ext) == 0;
 }