[vlc-commits] zip: remove uneeded allocation

Rémi Duraffort git at videolan.org
Tue Aug 13 22:05:37 CEST 2013


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Aug 13 20:00:07 2013 +0200| [513a5123316c6c22780f53f335f07ada4b13a6a9] | committer: Rémi Duraffort

zip: remove uneeded allocation

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

 modules/access/zip/zipaccess.c |   26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/modules/access/zip/zipaccess.c b/modules/access/zip/zipaccess.c
index 2b56332..016afcc 100644
--- a/modules/access/zip/zipaccess.c
+++ b/modules/access/zip/zipaccess.c
@@ -145,24 +145,18 @@ int AccessOpen( vlc_object_t *p_this )
     }
 
     /* Define IO functions */
-    zlib_filefunc_def *p_func = (zlib_filefunc_def*)
-                                    calloc( 1, sizeof( zlib_filefunc_def ) );
-    if( unlikely( !p_func ) )
-    {
-        i_ret = VLC_ENOMEM;
-        goto exit;
-    }
-    p_func->zopen_file   = ZipIO_Open;
-    p_func->zread_file   = ZipIO_Read;
-    p_func->zwrite_file  = ZipIO_Write; // see comment
-    p_func->ztell_file   = ZipIO_Tell;
-    p_func->zseek_file   = ZipIO_Seek;
-    p_func->zclose_file  = ZipIO_Close;
-    p_func->zerror_file  = ZipIO_Error;
-    p_func->opaque       = p_access;
+    zlib_filefunc_def func;
+    func.zopen_file   = ZipIO_Open;
+    func.zread_file   = ZipIO_Read;
+    func.zwrite_file  = ZipIO_Write; // see comment
+    func.ztell_file   = ZipIO_Tell;
+    func.zseek_file   = ZipIO_Seek;
+    func.zclose_file  = ZipIO_Close;
+    func.zerror_file  = ZipIO_Error;
+    func.opaque       = p_access;
 
     /* Open zip archive */
-    p_access->p_sys->zipFile = unzOpen2( psz_pathToZip, p_func );
+    p_access->p_sys->zipFile = unzOpen2( psz_pathToZip, &func );
     if( !p_access->p_sys->zipFile )
     {
         msg_Err( p_access, "not a valid zip archive: '%s'", psz_pathToZip );



More information about the vlc-commits mailing list