use memset so we never have this problem again and also put in
authorCarsten Haitzler <raster@rasterman.com>
Wed, 23 May 2012 04:26:24 +0000 (04:26 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Wed, 23 May 2012 04:26:24 +0000 (04:26 +0000)
eina_file_win32.c

SVN revision: 71345

legacy/eina/src/lib/eina_file.c
legacy/eina/src/lib/eina_file_win32.c

index 544ded8..33137cc 100644 (file)
@@ -990,13 +990,14 @@ eina_file_open(const char *path, Eina_Bool shared)
 
    if (!file)
      {
-        n = malloc(sizeof (Eina_File) + strlen(filename) + 1);
+        n = malloc(sizeof(Eina_File) + strlen(filename) + 1);
         if (!n)
          {
              eina_lock_release(&_eina_file_lock_cache);
              goto on_error;
          }
 
+        memset(n, 0, sizeof(Eina_File));
         n->filename = (char*) (n + 1);
         strcpy((char*) n->filename, filename);
         n->map = eina_hash_new(EINA_KEY_LENGTH(_eina_file_map_key_length),
@@ -1006,7 +1007,6 @@ eina_file_open(const char *path, Eina_Bool shared)
                                3);
         n->rmap = eina_hash_pointer_new(NULL);
         n->global_map = MAP_FAILED;
-       n->global_refcount = 0;
         n->length = file_stat.st_size;
         n->mtime = file_stat.st_mtime;
 #ifdef _STAT_VER_LINUX
@@ -1017,11 +1017,8 @@ eina_file_open(const char *path, Eina_Bool shared)
 # endif
 #endif
         n->inode = file_stat.st_ino;
-        n->refcount = 0;
         n->fd = fd;
         n->shared = shared;
-        n->delete_me = EINA_FALSE;
-        n->global_faulty = EINA_FALSE;
         eina_lock_new(&n->lock);
         eina_hash_direct_add(_eina_file_cache, n->filename, n);
      }
index ba587a6..3037c0f 100644 (file)
@@ -942,6 +942,7 @@ eina_file_open(const char *path, Eina_Bool shared)
              goto close_fm;
           }
 
+        memset(n, 0, sizeof(Eina_File));
         n->filename = (char*) (n + 1);
         strcpy((char*) n->filename, filename);
         n->map = eina_hash_new(EINA_KEY_LENGTH(_eina_file_map_key_length),
@@ -951,14 +952,11 @@ eina_file_open(const char *path, Eina_Bool shared)
                                3);
         n->rmap = eina_hash_pointer_new(NULL);
         n->global_map = MAP_FAILED;
-        n->global_refcount = 0;
         n->length = length.QuadPart;
         n->mtime = mtime.QuadPart;
-        n->refcount = 0;
         n->handle = handle;
         n->fm = fm;
         n->shared = shared;
-        n->delete_me = EINA_FALSE;
         eina_lock_new(&n->lock);
         eina_hash_direct_add(_eina_file_cache, n->filename, n);
      }