summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2014-01-20 12:03:02 +0900
committerCedric BAIL <cedric.bail@samsung.com>2014-01-20 13:04:07 +0900
commitf8b0322704a4d74e4a5545727c18dc8385318657 (patch)
tree9219778738fa4f7ffd60d62ac7f5caa5261000a8 /src
parent55a56fe5c06f9ecb4c0b28e1c1f7bf5828db2d64 (diff)
eet: do not load data when the file is open in read/write mode.
I do think that it was a left over from previous file format. Removing this memcpy should make Enlightenment startup faster and should reduce by 500KB the memory it use.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eet/eet_lib.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index 6ff2a3cbd3..63f8e4f5f7 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -482,7 +482,12 @@ eet_flush2(Eet_File *ef)
482 { 482 {
483 for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next) 483 for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
484 { 484 {
485 if (fwrite(efn->data, efn->size, 1, fp) != 1) 485 if (efn->data)
486 {
487 if (fwrite(efn->data, efn->size, 1, fp) != 1)
488 goto write_error;
489 }
490 else if (fwrite(ef->data + efn->offset, efn->size, 1, fp) != 1)
486 goto write_error; 491 goto write_error;
487 } 492 }
488 } 493 }
@@ -904,15 +909,8 @@ eet_internal_read2(Eet_File *ef)
904 efn->next = ef->header->directory->nodes[hash]; 909 efn->next = ef->header->directory->nodes[hash];
905 ef->header->directory->nodes[hash] = efn; 910 ef->header->directory->nodes[hash] = efn;
906 911
907 /* read-only mode, so currently we have no data loaded */ 912 /* There is no need to load data at this stage */
908 if (ef->mode == EET_FILE_MODE_READ) 913 efn->data = NULL;
909 efn->data = NULL; /* read-write mode - read everything into ram */
910 else
911 {
912 efn->data = malloc(efn->size);
913 if (efn->data)
914 memcpy(efn->data, ef->data + efn->offset, efn->size);
915 }
916 914
917 /* compute the possible position of a signature */ 915 /* compute the possible position of a signature */
918 if (signature_base_offset < efn->offset + efn->size) 916 if (signature_base_offset < efn->offset + efn->size)