ef->path is now stringshared

SVN revision: 65813
This commit is contained in:
Mike Blumenkrantz 2011-12-02 14:07:34 +00:00
parent 3e0353f80b
commit fb3c8a5de8
3 changed files with 6 additions and 5 deletions

View File

@ -550,3 +550,4 @@
2011-12-02 Mike Blumenkrantz 2011-12-02 Mike Blumenkrantz
* added eet_file_get to return the filename of an Eet_File * added eet_file_get to return the filename of an Eet_File
* Eet_File filenames are now stringshared

View File

@ -755,7 +755,7 @@ eet_delete(Eet_File *ef,
/** /**
* Alias a specific section to another one. Destination may exist or not, * Alias a specific section to another one. Destination may exist or not,
* no check are done. * no checks are done.
* @param ef A valid eet file handle opened for writing. * @param ef A valid eet file handle opened for writing.
* @param name Name of the new entry. eg: "/base/file_i_want". * @param name Name of the new entry. eg: "/base/file_i_want".
* @param destination Actual source of the aliased entry eg: "/base/the_real_stuff_i_want". * @param destination Actual source of the aliased entry eg: "/base/the_real_stuff_i_want".
@ -777,7 +777,7 @@ eet_alias(Eet_File *ef,
/** /**
* Retrieve the filename of an Eet_File * Retrieve the filename of an Eet_File
* @param ef A valid eet file handle opened for writing. * @param ef A valid eet file handle opened for writing.
* @return The file opened with eet_open(), or NULL on error * @return The stringshared file string opened with eet_open(), or NULL on error
* *
* @note This function will return NULL for files opened with eet_memopen_read() * @note This function will return NULL for files opened with eet_memopen_read()
* *

View File

@ -88,7 +88,7 @@ typedef struct _Eet_File_Directory Eet_File_Directory;
struct _Eet_File struct _Eet_File
{ {
char *path; const char *path;
Eina_File *readfp; Eina_File *readfp;
Eet_File_Header *header; Eet_File_Header *header;
Eet_Dictionary *ed; Eet_Dictionary *ed;
@ -1434,6 +1434,7 @@ eet_internal_close(Eet_File *ef,
memset(ef, 0, sizeof(Eet_File)); memset(ef, 0, sizeof(Eet_File));
/* free it */ /* free it */
eina_stringshare_del(ef->path);
free(ef); free(ef);
return err; return err;
@ -1593,8 +1594,7 @@ open_error:
INIT_FILE(ef); INIT_FILE(ef);
ef->key = NULL; ef->key = NULL;
ef->readfp = fp; ef->readfp = fp;
ef->path = ((char *)ef) + sizeof(Eet_File); ef->path = eina_stringshare_add_length(file, file_len);
memcpy(ef->path, file, file_len);
ef->magic = EET_MAGIC_FILE; ef->magic = EET_MAGIC_FILE;
ef->references = 1; ef->references = 1;
ef->mode = mode; ef->mode = mode;