[FFmpeg-soc] [soc]: r4641 - concat/libavformat/m3u.c

gkovacs subversion at mplayerhq.hu
Mon Jul 6 22:08:38 CEST 2009


Author: gkovacs
Date: Mon Jul  6 22:08:38 2009
New Revision: 4641

Log:
switched to av_fast_realloc in m3u_list_files

Modified:
   concat/libavformat/m3u.c

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Mon Jul  6 21:25:34 2009	(r4640)
+++ concat/libavformat/m3u.c	Mon Jul  6 22:08:38 2009	(r4641)
@@ -41,13 +41,10 @@ static int m3u_probe(AVProbeData *p)
 }
 
 static int m3u_list_files(ByteIOContext *s, PlaylistContext *ctx)
-//                          char ***flist_ptr,
-//                          unsigned int *lfx_ptr,
-//                          char *workingdir)
 {
     char **flist;
     int i, j;
-    int bufsize = 16;
+    int bufsize = 0;
     i = 0;
     flist = av_malloc(sizeof(char*) * bufsize);
     while (1) {
@@ -56,11 +53,8 @@ static int m3u_list_files(ByteIOContext 
             break;
         if (*c == 0) // hashed out
             continue;
-        flist[i] = c;
-        if (++i == bufsize) {
-            bufsize += 16;
-            flist = av_realloc(flist, sizeof(char*) * bufsize);
-        }
+        flist = av_fast_realloc(flist, &bufsize, i+2);
+        flist[i++] = c;
     }
     ctx->pelist_size = i;
     flist[i] = 0;


More information about the FFmpeg-soc mailing list