Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : libs/eet

Dir     : e17/libs/eet/src/lib


Modified Files:
        eet_lib.c 


Log Message:
The comment does say "Allocate struct for eet file and have it zero'd
out" but using calloc is inefficient since most members of the struct
are written to straight away.  Valgrind complains that the data member
can sometimes be used without being initialised.  Seems to happen when
we can't open it and eet_close tests the value of the data member.

Those that know this code better than me should check this. Probably a
good idea to initialise ALL members at this point.

===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_lib.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- eet_lib.c   15 Aug 2006 06:45:51 -0000      1.68
+++ eet_lib.c   17 Aug 2006 20:22:23 -0000      1.69
@@ -536,6 +536,8 @@
    ef->header = NULL;
    ef->mtime = file_stat.st_mtime;
    ef->delete_me_now = 0;
+   ef->data = NULL;
+   ef->data_size = 0;
 
    /* try open the file based on mode */
    if ((ef->mode == EET_FILE_MODE_READ) || (ef->mode == 
EET_FILE_MODE_READ_WRITE))
@@ -555,9 +557,6 @@
    /* if we can't open - bail out */
    if (eet_test_close(!ef->fp, ef))
      return NULL;
-
-   ef->data = NULL;
-   ef->data_size = 0;
 
    fcntl(fileno(ef->fp), F_SETFD, FD_CLOEXEC);
    /* if we opened for read or read-write */



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to