summaryrefslogtreecommitdiff
path: root/src/lib/eet/eet_lib.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2013-04-05 12:14:50 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-04-05 12:14:50 +0900
commit5465eb3accf8661675ff4c9111328077276fee98 (patch)
tree562301b66a662b7fe1fc19c2ed289bd7e60c5838 /src/lib/eet/eet_lib.c
parentf001cfac383f829b02b164692f37516108c9ccb1 (diff)
eet: remove use of prev to reduce memory usage (30KB on 32bits system).
Diffstat (limited to 'src/lib/eet/eet_lib.c')
-rw-r--r--src/lib/eet/eet_lib.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index fd835af2c8..4716f6aac1 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -445,11 +445,16 @@ eet_flush2(Eet_File *ef)
445 for (j = 0; j < ef->ed->count; ++j) 445 for (j = 0; j < ef->ed->count; ++j)
446 { 446 {
447 int sbuf[EET_FILE2_DICTIONARY_ENTRY_COUNT]; 447 int sbuf[EET_FILE2_DICTIONARY_ENTRY_COUNT];
448 int prev = 0;
449
450 // We still use the prev as an hint for knowing if it is the head of the hash
451 if (ef->ed->hash[ef->ed->all_hash[j]] == j)
452 prev = -1;
448 453
449 sbuf[0] = (int)htonl((unsigned int)ef->ed->all_hash[j]); 454 sbuf[0] = (int)htonl((unsigned int)ef->ed->all_hash[j]);
450 sbuf[1] = (int)htonl((unsigned int)offset); 455 sbuf[1] = (int)htonl((unsigned int)offset);
451 sbuf[2] = (int)htonl((unsigned int)ef->ed->all[j].len); 456 sbuf[2] = (int)htonl((unsigned int)ef->ed->all[j].len);
452 sbuf[3] = (int)htonl((unsigned int)ef->ed->all[j].prev); 457 sbuf[3] = (int)htonl((unsigned int)prev);
453 sbuf[4] = (int)htonl((unsigned int)ef->ed->all[j].next); 458 sbuf[4] = (int)htonl((unsigned int)ef->ed->all[j].next);
454 459
455 offset += ef->ed->all[j].len; 460 offset += ef->ed->all[j].len;
@@ -959,12 +964,13 @@ eet_internal_read2(Eet_File *ef)
959 for (j = 0; j < ef->ed->count; ++j) 964 for (j = 0; j < ef->ed->count; ++j)
960 { 965 {
961 unsigned int offset; 966 unsigned int offset;
967 int prev;
962 int hash; 968 int hash;
963 969
964 GET_INT(hash, dico, idx); 970 GET_INT(hash, dico, idx);
965 GET_INT(offset, dico, idx); 971 GET_INT(offset, dico, idx);
966 GET_INT(ef->ed->all[j].len, dico, idx); 972 GET_INT(ef->ed->all[j].len, dico, idx);
967 GET_INT(ef->ed->all[j].prev, dico, idx); 973 GET_INT(prev, dico, idx); // Let's ignore prev link for dictionary, use it only as an hint to head
968 GET_INT(ef->ed->all[j].next, dico, idx); 974 GET_INT(ef->ed->all[j].next, dico, idx);
969 975
970 /* Hash value could be stored on 8bits data, but this will break alignment of all the others data. 976 /* Hash value could be stored on 8bits data, but this will break alignment of all the others data.
@@ -992,7 +998,7 @@ eet_internal_read2(Eet_File *ef)
992 return NULL; 998 return NULL;
993 999
994 ef->ed->all_hash[j] = hash; 1000 ef->ed->all_hash[j] = hash;
995 if (ef->ed->all[j].prev == -1) 1001 if (prev == -1)
996 ef->ed->hash[hash] = j; 1002 ef->ed->hash[hash] = j;
997 1003
998 /* compute the possible position of a signature */ 1004 /* compute the possible position of a signature */