summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--legacy/eet/ChangeLog1
-rw-r--r--legacy/eet/NEWS3
-rw-r--r--legacy/eet/src/lib/Eet_private.h136
-rw-r--r--legacy/eet/src/lib/Makefile.am1
-rw-r--r--legacy/eet/src/lib/eet_alloc.c95
-rw-r--r--legacy/eet/src/lib/eet_dictionary.c21
-rw-r--r--legacy/eet/src/lib/eet_lib.c177
7 files changed, 279 insertions, 155 deletions
diff --git a/legacy/eet/ChangeLog b/legacy/eet/ChangeLog
index ed908482b7..9db34e05f7 100644
--- a/legacy/eet/ChangeLog
+++ b/legacy/eet/ChangeLog
@@ -551,3 +551,4 @@
551 551
552 * added eet_file_get to return the filename of an Eet_File 552 * added eet_file_get to return the filename of an Eet_File
553 * Eet_File filenames are now stringshared 553 * Eet_File filenames are now stringshared
554 * added mempool allocators
diff --git a/legacy/eet/NEWS b/legacy/eet/NEWS
index 3e11314af8..cccda15052 100644
--- a/legacy/eet/NEWS
+++ b/legacy/eet/NEWS
@@ -6,6 +6,9 @@ Changes since Eet 1.5.0:
6Additions: 6Additions:
7 * eet_file_get to return filenames of Eet_Files 7 * eet_file_get to return filenames of Eet_Files
8 8
9Improvements:
10
11 * most allocations moved to mempools
9 12
10Eet 1.5.0 13Eet 1.5.0
11 14
diff --git a/legacy/eet/src/lib/Eet_private.h b/legacy/eet/src/lib/Eet_private.h
index 83f4c18a63..0234221b53 100644
--- a/legacy/eet/src/lib/Eet_private.h
+++ b/legacy/eet/src/lib/Eet_private.h
@@ -66,6 +66,126 @@ struct _Eet_Node
66 Eet_Node_Data data; 66 Eet_Node_Data data;
67}; 67};
68 68
69typedef struct _Eet_File_Header Eet_File_Header;
70typedef struct _Eet_File_Node Eet_File_Node;
71typedef struct _Eet_File_Directory Eet_File_Directory;
72
73struct _Eet_File
74{
75 const char *path;
76 Eina_File *readfp;
77 Eet_File_Header *header;
78 Eet_Dictionary *ed;
79 Eet_Key *key;
80 const unsigned char *data;
81 const void *x509_der;
82 const void *signature;
83 void *sha1;
84
85 Eet_File_Mode mode;
86
87 int magic;
88 int references;
89
90 unsigned long int data_size;
91 int x509_length;
92 unsigned int signature_length;
93 int sha1_length;
94
95 Eina_Lock file_lock;
96
97 unsigned char writes_pending : 1;
98 unsigned char delete_me_now : 1;
99};
100
101struct _Eet_File_Header
102{
103 int magic;
104 Eet_File_Directory *directory;
105};
106
107struct _Eet_File_Directory
108{
109 int size;
110 Eet_File_Node **nodes;
111};
112
113struct _Eet_File_Node
114{
115 char *name;
116 void *data;
117 Eet_File_Node *next; /* FIXME: make buckets linked lists */
118
119 unsigned long int offset;
120 unsigned long int dictionary_offset;
121 unsigned long int name_offset;
122
123 unsigned int name_size;
124 unsigned int size;
125 unsigned int data_size;
126
127 unsigned char free_name : 1;
128 unsigned char compression : 1;
129 unsigned char ciphered : 1;
130 unsigned char alias : 1;
131};
132
133#if 0
134/* Version 2 */
135/* NB: all int's are stored in network byte order on disk */
136/* file format: */
137int magic; /* magic number ie 0x1ee7ff00 */
138int num_directory_entries; /* number of directory entries to follow */
139int bytes_directory_entries; /* bytes of directory entries to follow */
140struct
141{
142 int offset; /* bytes offset into file for data chunk */
143 int flags; /* flags - for now 0 = uncompressed and clear, 1 = compressed and clear, 2 = uncompressed and ciphered, 3 = compressed and ciphered */
144 int size; /* size of the data chunk */
145 int data_size; /* size of the (uncompressed) data chunk */
146 int name_size; /* length in bytes of the name field */
147 char name[name_size]; /* name string (variable length) and \0 terminated */
148} directory[num_directory_entries];
149/* and now startes the data stream... */
150#endif /* if 0 */
151
152#if 0
153/* Version 3 */
154/* NB: all int's are stored in network byte order on disk */
155/* file format: */
156int magic; /* magic number ie 0x1ee70f42 */
157int num_directory_entries; /* number of directory entries to follow */
158int num_dictionary_entries; /* number of dictionary entries to follow */
159struct
160{
161 int data_offset; /* bytes offset into file for data chunk */
162 int size; /* size of the data chunk */
163 int data_size; /* size of the (uncompressed) data chunk */
164 int name_offset; /* bytes offset into file for name string */
165 int name_size; /* length in bytes of the name field */
166 int flags; /* bit flags - for now:
167 bit 0 => compresion on/off
168 bit 1 => ciphered on/off
169 bit 2 => alias
170 */
171} directory[num_directory_entries];
172struct
173{
174 int hash;
175 int offset;
176 int size;
177 int prev;
178 int next;
179} dictionary[num_dictionary_entries];
180/* now start the string stream. */
181/* and right after them the data stream. */
182int magic_sign; /* Optional, only if the eet file is signed. */
183int signature_length; /* Signature length. */
184int x509_length; /* Public certificate that signed the file. */
185char signature[signature_length]; /* The signature. */
186char x509[x509_length]; /* The public certificate. */
187#endif /* if 0 */
188
69/* 189/*
70 * variable and macros used for the eina_log module 190 * variable and macros used for the eina_log module
71 */ 191 */
@@ -178,6 +298,22 @@ Eet_Node *
178void 298void
179 eet_node_free(Eet_Node *node); 299 eet_node_free(Eet_Node *node);
180 300
301
302#define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \
303 TYPE *Type##_malloc(unsigned int); \
304 TYPE *Type##_calloc(unsigned int); \
305 void Type##_mp_free(TYPE *e);
306
307GENERIC_ALLOC_FREE_HEADER(Eet_File_Directory, eet_file_directory);
308GENERIC_ALLOC_FREE_HEADER(Eet_File_Node, eet_file_node);
309GENERIC_ALLOC_FREE_HEADER(Eet_File_Header, eet_file_header);
310GENERIC_ALLOC_FREE_HEADER(Eet_Dictionary, eet_dictionary);
311GENERIC_ALLOC_FREE_HEADER(Eet_File, eet_file);
312GENERIC_ALLOC_FREE_HEADER(Eet_String, eet_string);
313
314Eina_Bool eet_mempool_init(void);
315void eet_mempool_shutdown(void);
316
181#ifndef PATH_MAX 317#ifndef PATH_MAX
182# define PATH_MAX 4096 318# define PATH_MAX 4096
183#endif /* ifndef PATH_MAX */ 319#endif /* ifndef PATH_MAX */
diff --git a/legacy/eet/src/lib/Makefile.am b/legacy/eet/src/lib/Makefile.am
index 4633749d39..ae60168596 100644
--- a/legacy/eet/src/lib/Makefile.am
+++ b/legacy/eet/src/lib/Makefile.am
@@ -22,6 +22,7 @@ includesdir = $(includedir)/eet-@VMAJ@
22lib_LTLIBRARIES = libeet.la 22lib_LTLIBRARIES = libeet.la
23 23
24base_sources = \ 24base_sources = \
25eet_alloc.c \
25eet_lib.c \ 26eet_lib.c \
26eet_data.c \ 27eet_data.c \
27eet_image.c \ 28eet_image.c \
diff --git a/legacy/eet/src/lib/eet_alloc.c b/legacy/eet/src/lib/eet_alloc.c
new file mode 100644
index 0000000000..2f62b1b446
--- /dev/null
+++ b/legacy/eet/src/lib/eet_alloc.c
@@ -0,0 +1,95 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include "Eet.h"
7#include "Eet_private.h"
8
9typedef struct _Eet_Mempool Eet_Mempool;
10struct _Eet_Mempool
11{
12 const char *name;
13 Eina_Mempool *mp;
14 size_t size;
15};
16
17#define GENERIC_ALLOC_FREE(TYPE, Type) \
18 Eet_Mempool Type##_mp = { #TYPE, NULL, sizeof (TYPE) }; \
19 \
20 TYPE * \
21 Type##_malloc(unsigned int num) \
22 { \
23 return eina_mempool_malloc(Type##_mp.mp, num * sizeof (TYPE)); \
24 } \
25 TYPE * \
26 Type##_calloc(unsigned int num) \
27 { \
28 return eina_mempool_calloc(Type##_mp.mp, num * sizeof (TYPE)); \
29 } \
30 void \
31 Type##_mp_free(TYPE *e) \
32 { \
33 eina_mempool_free(Type##_mp.mp, e); \
34 }
35
36GENERIC_ALLOC_FREE(Eet_File_Directory, eet_file_directory);
37GENERIC_ALLOC_FREE(Eet_File_Node, eet_file_node);
38GENERIC_ALLOC_FREE(Eet_File_Header, eet_file_header);
39GENERIC_ALLOC_FREE(Eet_Dictionary, eet_dictionary);
40GENERIC_ALLOC_FREE(Eet_File, eet_file);
41GENERIC_ALLOC_FREE(Eet_String, eet_string);
42
43static Eet_Mempool *mempool_array[] = {
44 &eet_file_directory_mp,
45 &eet_file_node_mp,
46 &eet_file_header_mp,
47 &eet_dictionary_mp,
48 &eet_file_mp,
49 &eet_string_mp
50};
51
52Eina_Bool
53eet_mempool_init(void)
54{
55 const char *choice;
56 unsigned int i;
57
58 choice = getenv("EINA_MEMPOOL");
59 if ((!choice) || (!choice[0]))
60 choice = "chained_mempool";
61
62 for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
63 {
64 retry:
65 mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64);
66 if (!mempool_array[i]->mp)
67 {
68 if (!strcmp(choice, "pass_through"))
69 {
70 ERR("Falling back to pass through ! Previously tried '%s' mempool.", choice);
71 choice = "pass_through";
72 goto retry;
73 }
74 else
75 {
76 ERR("Impossible to allocate mempool '%s' !", choice);
77 return EINA_FALSE;
78 }
79 }
80 }
81 return EINA_TRUE;
82}
83
84void
85eet_mempool_shutdown(void)
86{
87 unsigned int i;
88
89 for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
90 {
91 eina_mempool_del(mempool_array[i]->mp);
92 mempool_array[i]->mp = NULL;
93 }
94}
95
diff --git a/legacy/eet/src/lib/eet_dictionary.c b/legacy/eet/src/lib/eet_dictionary.c
index 3f35066266..d551d5f254 100644
--- a/legacy/eet/src/lib/eet_dictionary.c
+++ b/legacy/eet/src/lib/eet_dictionary.c
@@ -28,21 +28,20 @@ eet_dictionary_add(void)
28void 28void
29eet_dictionary_free(Eet_Dictionary *ed) 29eet_dictionary_free(Eet_Dictionary *ed)
30{ 30{
31 if (ed) 31 int i;
32 {
33 int i;
34 32
35 for (i = 0; i < ed->count; ++i) 33 if (!ed) return;
36 if (ed->all[i].allocated)
37 eina_stringshare_del(ed->all[i].str);
38 34
39 if (ed->all) 35 for (i = 0; i < ed->count; ++i)
40 free(ed->all); 36 if (ed->all[i].allocated)
37 eina_stringshare_del(ed->all[i].str);
41 38
42 if (ed->converts) eina_hash_free(ed->converts); 39 if (ed->all)
40 eet_string_mp_free(ed->all);
43 41
44 free(ed); 42 if (ed->converts) eina_hash_free(ed->converts);
45 } 43
44 eet_dictionary_mp_free(ed);
46} 45}
47 46
48static int 47static int
diff --git a/legacy/eet/src/lib/eet_lib.c b/legacy/eet/src/lib/eet_lib.c
index 089f9d3ccc..dc1529003f 100644
--- a/legacy/eet/src/lib/eet_lib.c
+++ b/legacy/eet/src/lib/eet_lib.c
@@ -82,126 +82,6 @@ EAPI Eet_Version *eet_version = &_version;
82 82
83#define EET_MAGIC_FILE2 0x1ee70f42 83#define EET_MAGIC_FILE2 0x1ee70f42
84 84
85typedef struct _Eet_File_Header Eet_File_Header;
86typedef struct _Eet_File_Node Eet_File_Node;
87typedef struct _Eet_File_Directory Eet_File_Directory;
88
89struct _Eet_File
90{
91 const char *path;
92 Eina_File *readfp;
93 Eet_File_Header *header;
94 Eet_Dictionary *ed;
95 Eet_Key *key;
96 const unsigned char *data;
97 const void *x509_der;
98 const void *signature;
99 void *sha1;
100
101 Eet_File_Mode mode;
102
103 int magic;
104 int references;
105
106 unsigned long int data_size;
107 int x509_length;
108 unsigned int signature_length;
109 int sha1_length;
110
111 Eina_Lock file_lock;
112
113 unsigned char writes_pending : 1;
114 unsigned char delete_me_now : 1;
115};
116
117struct _Eet_File_Header
118{
119 int magic;
120 Eet_File_Directory *directory;
121};
122
123struct _Eet_File_Directory
124{
125 int size;
126 Eet_File_Node **nodes;
127};
128
129struct _Eet_File_Node
130{
131 char *name;
132 void *data;
133 Eet_File_Node *next; /* FIXME: make buckets linked lists */
134
135 unsigned long int offset;
136 unsigned long int dictionary_offset;
137 unsigned long int name_offset;
138
139 unsigned int name_size;
140 unsigned int size;
141 unsigned int data_size;
142
143 unsigned char free_name : 1;
144 unsigned char compression : 1;
145 unsigned char ciphered : 1;
146 unsigned char alias : 1;
147};
148
149#if 0
150/* Version 2 */
151/* NB: all int's are stored in network byte order on disk */
152/* file format: */
153int magic; /* magic number ie 0x1ee7ff00 */
154int num_directory_entries; /* number of directory entries to follow */
155int bytes_directory_entries; /* bytes of directory entries to follow */
156struct
157{
158 int offset; /* bytes offset into file for data chunk */
159 int flags; /* flags - for now 0 = uncompressed and clear, 1 = compressed and clear, 2 = uncompressed and ciphered, 3 = compressed and ciphered */
160 int size; /* size of the data chunk */
161 int data_size; /* size of the (uncompressed) data chunk */
162 int name_size; /* length in bytes of the name field */
163 char name[name_size]; /* name string (variable length) and \0 terminated */
164} directory[num_directory_entries];
165/* and now startes the data stream... */
166#endif /* if 0 */
167
168#if 0
169/* Version 3 */
170/* NB: all int's are stored in network byte order on disk */
171/* file format: */
172int magic; /* magic number ie 0x1ee70f42 */
173int num_directory_entries; /* number of directory entries to follow */
174int num_dictionary_entries; /* number of dictionary entries to follow */
175struct
176{
177 int data_offset; /* bytes offset into file for data chunk */
178 int size; /* size of the data chunk */
179 int data_size; /* size of the (uncompressed) data chunk */
180 int name_offset; /* bytes offset into file for name string */
181 int name_size; /* length in bytes of the name field */
182 int flags; /* bit flags - for now:
183 bit 0 => compresion on/off
184 bit 1 => ciphered on/off
185 bit 2 => alias
186 */
187} directory[num_directory_entries];
188struct
189{
190 int hash;
191 int offset;
192 int size;
193 int prev;
194 int next;
195} dictionary[num_dictionary_entries];
196/* now start the string stream. */
197/* and right after them the data stream. */
198int magic_sign; /* Optional, only if the eet file is signed. */
199int signature_length; /* Signature length. */
200int x509_length; /* Public certificate that signed the file. */
201char signature[signature_length]; /* The signature. */
202char x509[x509_length]; /* The public certificate. */
203#endif /* if 0 */
204
205#define EET_FILE2_HEADER_COUNT 3 85#define EET_FILE2_HEADER_COUNT 3
206#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6 86#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6
207#define EET_FILE2_DICTIONARY_ENTRY_COUNT 5 87#define EET_FILE2_DICTIONARY_ENTRY_COUNT 5
@@ -694,12 +574,18 @@ eet_init(void)
694 574
695 eina_lock_new(&eet_cache_lock); 575 eina_lock_new(&eet_cache_lock);
696 576
697 if (!eet_node_init()) 577 if (!eet_mempool_init())
698 { 578 {
699 EINA_LOG_ERR("Eet: Eet_Node mempool creation failed"); 579 EINA_LOG_ERR("Eet: Eet_Node mempool creation failed");
700 goto unregister_log_domain; 580 goto unregister_log_domain;
701 } 581 }
702 582
583 if (!eet_node_init())
584 {
585 EINA_LOG_ERR("Eet: Eet_Node mempool creation failed");
586 goto shutdown_mempool;
587 }
588
703#ifdef HAVE_GNUTLS 589#ifdef HAVE_GNUTLS
704 /* Before the library can be used, it must initialize itself if needed. */ 590 /* Before the library can be used, it must initialize itself if needed. */
705 if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0) 591 if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
@@ -741,6 +627,8 @@ eet_init(void)
741shutdown_eet: 627shutdown_eet:
742#endif 628#endif
743 eet_node_shutdown(); 629 eet_node_shutdown();
630shutdown_mempool:
631 eet_mempool_shutdown();
744unregister_log_domain: 632unregister_log_domain:
745 eina_log_domain_unregister(_eet_log_dom_global); 633 eina_log_domain_unregister(_eet_log_dom_global);
746 _eet_log_dom_global = -1; 634 _eet_log_dom_global = -1;
@@ -757,6 +645,7 @@ eet_shutdown(void)
757 645
758 eet_clearcache(); 646 eet_clearcache();
759 eet_node_shutdown(); 647 eet_node_shutdown();
648 eet_mempool_shutdown();
760 649
761 eina_lock_free(&eet_cache_lock); 650 eina_lock_free(&eet_cache_lock);
762 651
@@ -902,14 +791,14 @@ eet_internal_read2(Eet_File *ef)
902 return NULL; 791 return NULL;
903 792
904 /* allocate header */ 793 /* allocate header */
905 ef->header = calloc(1, sizeof(Eet_File_Header)); 794 ef->header = eet_file_header_calloc(1);
906 if (eet_test_close(!ef->header, ef)) 795 if (eet_test_close(!ef->header, ef))
907 return NULL; 796 return NULL;
908 797
909 ef->header->magic = EET_MAGIC_FILE_HEADER; 798 ef->header->magic = EET_MAGIC_FILE_HEADER;
910 799
911 /* allocate directory block in ram */ 800 /* allocate directory block in ram */
912 ef->header->directory = calloc(1, sizeof(Eet_File_Directory)); 801 ef->header->directory = eet_file_directory_calloc(1);
913 if (eet_test_close(!ef->header->directory, ef)) 802 if (eet_test_close(!ef->header->directory, ef))
914 return NULL; 803 return NULL;
915 804
@@ -939,10 +828,10 @@ eet_internal_read2(Eet_File *ef)
939 828
940 /* out directory block is inconsistent - we have overrun our */ 829 /* out directory block is inconsistent - we have overrun our */
941 /* dynamic block buffer before we finished scanning dir entries */ 830 /* dynamic block buffer before we finished scanning dir entries */
942 efn = malloc(sizeof(Eet_File_Node)); 831 efn = eet_file_node_malloc(1);
943 if (eet_test_close(!efn, ef)) 832 if (eet_test_close(!efn, ef))
944 { 833 {
945 if (efn) free(efn); /* yes i know - we only get here if 834 if (efn) eet_file_node_mp_free(efn); /* yes i know - we only get here if
946 * efn is null/0 -> trying to shut up 835 * efn is null/0 -> trying to shut up
947 * warning tools like cppcheck */ 836 * warning tools like cppcheck */
948 return NULL; 837 return NULL;
@@ -1022,11 +911,11 @@ eet_internal_read2(Eet_File *ef)
1022 ef)) 911 ef))
1023 return NULL; 912 return NULL;
1024 913
1025 ef->ed = calloc(1, sizeof (Eet_Dictionary)); 914 ef->ed = eet_dictionary_calloc(1);
1026 if (eet_test_close(!ef->ed, ef)) 915 if (eet_test_close(!ef->ed, ef))
1027 return NULL; 916 return NULL;
1028 917
1029 ef->ed->all = calloc(num_dictionary_entries, sizeof (Eet_String)); 918 ef->ed->all = eet_string_calloc(num_dictionary_entries);
1030 if (eet_test_close(!ef->ed->all, ef)) 919 if (eet_test_close(!ef->ed->all, ef))
1031 return NULL; 920 return NULL;
1032 921
@@ -1162,14 +1051,14 @@ eet_internal_read1(Eet_File *ef)
1162 return NULL; 1051 return NULL;
1163 1052
1164 /* allocate header */ 1053 /* allocate header */
1165 ef->header = calloc(1, sizeof(Eet_File_Header)); 1054 ef->header = eet_file_header_calloc(1);
1166 if (eet_test_close(!ef->header, ef)) 1055 if (eet_test_close(!ef->header, ef))
1167 return NULL; 1056 return NULL;
1168 1057
1169 ef->header->magic = EET_MAGIC_FILE_HEADER; 1058 ef->header->magic = EET_MAGIC_FILE_HEADER;
1170 1059
1171 /* allocate directory block in ram */ 1060 /* allocate directory block in ram */
1172 ef->header->directory = calloc(1, sizeof(Eet_File_Directory)); 1061 ef->header->directory = eet_file_directory_calloc(1);
1173 if (eet_test_close(!ef->header->directory, ef)) 1062 if (eet_test_close(!ef->header->directory, ef))
1174 return NULL; 1063 return NULL;
1175 1064
@@ -1207,7 +1096,7 @@ eet_internal_read1(Eet_File *ef)
1207 efn = malloc (sizeof(Eet_File_Node)); 1096 efn = malloc (sizeof(Eet_File_Node));
1208 if (eet_test_close(!efn, ef)) 1097 if (eet_test_close(!efn, ef))
1209 { 1098 {
1210 if (efn) free(efn); /* yes i know - we only get here if 1099 if (efn) eet_file_node_mp_free(efn); /* yes i know - we only get here if
1211 * efn is null/0 -> trying to shut up 1100 * efn is null/0 -> trying to shut up
1212 * warning tools like cppcheck */ 1101 * warning tools like cppcheck */
1213 return NULL; 1102 return NULL;
@@ -1227,21 +1116,21 @@ eet_internal_read1(Eet_File *ef)
1227 /* invalid size */ 1116 /* invalid size */
1228 if (eet_test_close(efn->size <= 0, ef)) 1117 if (eet_test_close(efn->size <= 0, ef))
1229 { 1118 {
1230 free(efn); 1119 eet_file_node_mp_free(efn);
1231 return NULL; 1120 return NULL;
1232 } 1121 }
1233 1122
1234 /* invalid name_size */ 1123 /* invalid name_size */
1235 if (eet_test_close(name_size <= 0, ef)) 1124 if (eet_test_close(name_size <= 0, ef))
1236 { 1125 {
1237 free(efn); 1126 eet_file_node_mp_free(efn);
1238 return NULL; 1127 return NULL;
1239 } 1128 }
1240 1129
1241 /* reading name would mean falling off end of dyn_buf - invalid */ 1130 /* reading name would mean falling off end of dyn_buf - invalid */
1242 if (eet_test_close((p + 16 + name_size) > (dyn_buf + byte_entries), ef)) 1131 if (eet_test_close((p + 16 + name_size) > (dyn_buf + byte_entries), ef))
1243 { 1132 {
1244 free(efn); 1133 eet_file_node_mp_free(efn);
1245 return NULL; 1134 return NULL;
1246 } 1135 }
1247 1136
@@ -1257,7 +1146,7 @@ eet_internal_read1(Eet_File *ef)
1257 efn->name = malloc(sizeof(char) * name_size + 1); 1146 efn->name = malloc(sizeof(char) * name_size + 1);
1258 if (eet_test_close(!efn->name, ef)) 1147 if (eet_test_close(!efn->name, ef))
1259 { 1148 {
1260 free(efn); 1149 eet_file_node_mp_free(efn);
1261 return NULL; 1150 return NULL;
1262 } 1151 }
1263 1152
@@ -1405,16 +1294,16 @@ eet_internal_close(Eet_File *ef,
1405 if (efn->free_name) 1294 if (efn->free_name)
1406 free(efn->name); 1295 free(efn->name);
1407 1296
1408 free(efn); 1297 eet_file_node_mp_free(efn);
1409 } 1298 }
1410 } 1299 }
1411 free(ef->header->directory->nodes); 1300 free(ef->header->directory->nodes);
1412 } 1301 }
1413 1302
1414 free(ef->header->directory); 1303 eet_file_directory_mp_free(ef->header->directory);
1415 } 1304 }
1416 1305
1417 free(ef->header); 1306 eet_file_header_mp_free(ef->header);
1418 } 1307 }
1419 1308
1420 eet_dictionary_free(ef->ed); 1309 eet_dictionary_free(ef->ed);
@@ -1435,7 +1324,7 @@ eet_internal_close(Eet_File *ef,
1435 1324
1436 /* free it */ 1325 /* free it */
1437 eina_stringshare_del(ef->path); 1326 eina_stringshare_del(ef->path);
1438 free(ef); 1327 eet_file_mp_free(ef);
1439 return err; 1328 return err;
1440 1329
1441on_error: 1330on_error:
@@ -1586,7 +1475,7 @@ open_error:
1586 file_len = strlen(file) + 1; 1475 file_len = strlen(file) + 1;
1587 1476
1588 /* Allocate struct for eet file and have it zero'd out */ 1477 /* Allocate struct for eet file and have it zero'd out */
1589 ef = malloc(sizeof(Eet_File)); 1478 ef = eet_file_malloc(1);
1590 if (!ef) 1479 if (!ef)
1591 goto on_error; 1480 goto on_error;
1592 1481
@@ -2118,7 +2007,7 @@ eet_alias(Eet_File *ef,
2118 ef->header->directory = calloc(1, sizeof(Eet_File_Directory)); 2007 ef->header->directory = calloc(1, sizeof(Eet_File_Directory));
2119 if (!ef->header->directory) 2008 if (!ef->header->directory)
2120 { 2009 {
2121 free(ef->header); 2010 eet_file_header_mp_free(ef->header);
2122 ef->header = NULL; 2011 ef->header = NULL;
2123 goto on_error; 2012 goto on_error;
2124 } 2013 }
@@ -2131,7 +2020,7 @@ eet_alias(Eet_File *ef,
2131 (1 << ef->header->directory->size)); 2020 (1 << ef->header->directory->size));
2132 if (!ef->header->directory->nodes) 2021 if (!ef->header->directory->nodes)
2133 { 2022 {
2134 free(ef->header->directory); 2023 eet_file_directory_mp_free(ef->header->directory);
2135 ef->header = NULL; 2024 ef->header = NULL;
2136 goto on_error; 2025 goto on_error;
2137 } 2026 }
@@ -2278,7 +2167,7 @@ eet_write_cipher(Eet_File *ef,
2278 ef->header->directory = calloc(1, sizeof(Eet_File_Directory)); 2167 ef->header->directory = calloc(1, sizeof(Eet_File_Directory));
2279 if (!ef->header->directory) 2168 if (!ef->header->directory)
2280 { 2169 {
2281 free(ef->header); 2170 eet_file_header_mp_free(ef->header);
2282 ef->header = NULL; 2171 ef->header = NULL;
2283 goto on_error; 2172 goto on_error;
2284 } 2173 }
@@ -2291,7 +2180,7 @@ eet_write_cipher(Eet_File *ef,
2291 (1 << ef->header->directory->size)); 2180 (1 << ef->header->directory->size));
2292 if (!ef->header->directory->nodes) 2181 if (!ef->header->directory->nodes)
2293 { 2182 {
2294 free(ef->header->directory); 2183 eet_file_directory_mp_free(ef->header->directory);
2295 ef->header = NULL; 2184 ef->header = NULL;
2296 goto on_error; 2185 goto on_error;
2297 } 2186 }
@@ -2479,7 +2368,7 @@ eet_delete(Eet_File *ef,
2479 if (efn->free_name) 2368 if (efn->free_name)
2480 free(efn->name); 2369 free(efn->name);
2481 2370
2482 free(efn); 2371 eet_file_node_mp_free(efn);
2483 exists_already = 1; 2372 exists_already = 1;
2484 break; 2373 break;
2485 } 2374 }