diff --git a/legacy/eet/ChangeLog b/legacy/eet/ChangeLog index e5e0936e4a..ed908482b7 100644 --- a/legacy/eet/ChangeLog +++ b/legacy/eet/ChangeLog @@ -550,3 +550,4 @@ 2011-12-02 Mike Blumenkrantz * added eet_file_get to return the filename of an Eet_File + * Eet_File filenames are now stringshared diff --git a/legacy/eet/src/lib/Eet.h b/legacy/eet/src/lib/Eet.h index d0f43a5672..4ae09613f2 100644 --- a/legacy/eet/src/lib/Eet.h +++ b/legacy/eet/src/lib/Eet.h @@ -755,7 +755,7 @@ eet_delete(Eet_File *ef, /** * 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 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". @@ -777,7 +777,7 @@ eet_alias(Eet_File *ef, /** * Retrieve the filename of an Eet_File * @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() * diff --git a/legacy/eet/src/lib/eet_lib.c b/legacy/eet/src/lib/eet_lib.c index dabff875b8..82d85abc58 100644 --- a/legacy/eet/src/lib/eet_lib.c +++ b/legacy/eet/src/lib/eet_lib.c @@ -88,7 +88,7 @@ typedef struct _Eet_File_Directory Eet_File_Directory; struct _Eet_File { - char *path; + const char *path; Eina_File *readfp; Eet_File_Header *header; Eet_Dictionary *ed; @@ -1434,6 +1434,7 @@ eet_internal_close(Eet_File *ef, memset(ef, 0, sizeof(Eet_File)); /* free it */ + eina_stringshare_del(ef->path); free(ef); return err; @@ -1593,8 +1594,7 @@ open_error: INIT_FILE(ef); ef->key = NULL; ef->readfp = fp; - ef->path = ((char *)ef) + sizeof(Eet_File); - memcpy(ef->path, file, file_len); + ef->path = eina_stringshare_add_length(file, file_len); ef->magic = EET_MAGIC_FILE; ef->references = 1; ef->mode = mode;