[vlc-commits] commit: decomp: avoid large stack allocation ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Fri Mar 26 18:38:56 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Mar 26 19:31:23 2010 +0200| [40cc130202e898d57c6c93af1407cbf5ac6b6bd1] | committer: Rémi Denis-Courmont 

decomp: avoid large stack allocation

(It could be more efficient, but who cares? pipe overhead is probably
 worse)

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

 modules/stream_filter/decomp.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/stream_filter/decomp.c b/modules/stream_filter/decomp.c
index b300fa9..fd5c1ed 100644
--- a/modules/stream_filter/decomp.c
+++ b/modules/stream_filter/decomp.c
@@ -111,7 +111,10 @@ static void *Thread (void *data)
             break;
         vlc_cleanup_push (cleanup_mmap, buf);
 #else
-        unsigned char buf[bufsize];
+        unsigned char *buf = malloc (bufsize);
+        if (unlikely(buf == NULL))
+            break;
+        vlc_cleanup_push (free, buf);
 #endif
 
         len = stream_Read (stream->p_source, buf, bufsize);
@@ -140,9 +143,7 @@ static void *Thread (void *data)
                 break;
             }
         }
-#ifdef HAVE_VMSPLICE
-        vlc_cleanup_run (); /* munmap (buf, bufsize) */
-#endif
+        vlc_cleanup_run (); /* free (buf) */
     }
     while (!error);
 



More information about the vlc-commits mailing list