On Tue, 17 May 2011, Enlightenment SVN wrote:
> Log: > eina: fix eina_file to be really usable. too bad you didn't fix the windows part too... Vincent > > > Author: cedric > Date: 2011-05-17 09:17:28 -0700 (Tue, 17 May 2011) > New Revision: 59470 > Trac: http://trac.enlightenment.org/e/changeset/59470 > > Modified: > trunk/eina/src/lib/eina_file.c > > Modified: trunk/eina/src/lib/eina_file.c > =================================================================== > --- trunk/eina/src/lib/eina_file.c 2011-05-17 15:49:08 UTC (rev 59469) > +++ trunk/eina/src/lib/eina_file.c 2011-05-17 16:17:28 UTC (rev 59470) > @@ -118,6 +118,7 @@ > > unsigned long long length; > time_t mtime; > + ino_t inode; > > int refcount; > int global_refcount; > @@ -378,6 +379,8 @@ > static void > _eina_file_real_close(Eina_File *file) > { > + if (file->refcount != 0) return ; > + > eina_hash_free(file->rmap); > eina_hash_free(file->map); > > @@ -386,8 +389,6 @@ > > close(file->fd); > > - eina_stringshare_del(file->filename); > - > free(file); > } > > @@ -747,8 +748,10 @@ > int flags; > Eina_Bool create = EINA_FALSE; > > - /* FIXME: always open absolute path (need to fix filename according to > current > - directory) */ > + /* > + FIXME: always open absolute path > + (need to fix filename according to current directory) > + */ > > if (shared) > fd = shm_open(filename, O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO); > @@ -770,13 +773,14 @@ > > file = eina_hash_find(_eina_file_cache, filename); > if (file && (file->mtime != file_stat.st_mtime > - || file->length != (unsigned long long) file_stat.st_size)) > + || file->length != (unsigned long long) file_stat.st_size > + || file->inode != file_stat.st_ino)) > { > create = EINA_TRUE; > > if (file->refcount == 0) > { > - _eina_file_cache_lru = eina_list_prepend(_eina_file_cache_lru, > file); > + _eina_file_cache_lru = eina_list_remove(_eina_file_cache_lru, > file); > eina_hash_del(_eina_file_cache, file->filename, file); > > file = NULL; > @@ -790,10 +794,11 @@ > > if (!file || create) > { > - n = malloc(sizeof (Eina_File)); > + n = malloc(sizeof (Eina_File) + strlen(filename) + 1); > if (!n) goto on_error; > > - n->filename = eina_stringshare_add(filename); > + n->filename = (char*) (n + 1); > + strcpy((char*) n->filename, filename); > n->map = eina_hash_new(EINA_KEY_LENGTH(_eina_file_map_key_length), > EINA_KEY_CMP(_eina_file_map_key_cmp), > EINA_KEY_HASH(_eina_file_map_key_hash), > @@ -801,14 +806,17 @@ > 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; > + n->inode = file_stat.st_ino; > n->refcount = 0; > n->fd = fd; > n->shared = shared; > n->delete_me = EINA_FALSE; > > - eina_hash_set(_eina_file_cache, filename, n); > + if (file) eina_hash_del(_eina_file_cache, filename, file); > + eina_hash_direct_add(_eina_file_cache, n->filename, n); > } > else > { > > > ------------------------------------------------------------------------------ > Achieve unprecedented app performance and reliability > What every C/C++ and Fortran developer should know. > Learn how Intel has extended the reach of its next-generation tools > to help boost performance applications - inlcuding clusters. > http://p.sf.net/sfu/intel-dev2devmay > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > ------------------------------------------------------------------------------ Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel