ef->path is now stringshared
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 2 Dec 2011 14:07:34 +0000 (14:07 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 2 Dec 2011 14:07:34 +0000 (14:07 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eet@65813 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/Eet.h
src/lib/eet_lib.c

index e5e0936..ed90848 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 2011-12-02  Mike Blumenkrantz
 
         * added eet_file_get to return the filename of an Eet_File
+        * Eet_File filenames are now stringshared
index d0f43a5..4ae0961 100644 (file)
@@ -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()
  *
index dabff87..82d85ab 100644 (file)
@@ -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;