changeset 24500:dcb02dadd06c

Get rid of bloated ty_extension function
author reimar
date Sat, 15 Sep 2007 11:03:38 +0000
parents 1e57ce7abdbd
children 0d9578ee65cf
files libmpdemux/demux_ty.c
diffstat 1 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ty.c	Sat Sep 15 10:59:27 2007 +0000
+++ b/libmpdemux/demux_ty.c	Sat Sep 15 11:03:38 2007 +0000
@@ -110,16 +110,6 @@
 #define TMF_SIG "showing.xml"
 
 // ===========================================================================
-static int ty_extension(const char *name, const char *ext )
-{
-   int delta = strlen(name) - strlen(ext);
-   if (delta < 0) return 0;
-   name += delta;
-   return strcmp(name, ext) == 0;
-}
-
-
-// ===========================================================================
 static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo )
 {
    off_t   offset;
@@ -134,6 +124,7 @@
    {
       char    header[ 512 ];
       char    *name;
+      char    *extension;
       char    *sizestr;
       int     size;
       off_t   skip;
@@ -160,7 +151,8 @@
       if ( offset + skip > totalsize )
          size = totalsize - offset;
 
-      isty = ty_extension( name, ".ty" );
+      extension = strrchr(name, '.');
+      isty = extension && strcmp(extension, ".ty") == 0;
 
       mp_msg( MSGT_DEMUX, MSGL_DBG3, "name %-20.20s size %-12.12s %d %d\n",
          name, sizestr, size, isty );