forked from enlightenment/efl
early check of the open mode, slightly more efficient
SVN revision: 12933
This commit is contained in:
parent
c422759847
commit
ea8cac4716
|
@ -1,3 +1,7 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
|
||||||
#include "Eet.h"
|
#include "Eet.h"
|
||||||
#include "Eet_private.h"
|
#include "Eet_private.h"
|
||||||
|
|
||||||
|
@ -963,13 +967,16 @@ eet_write(Eet_File *ef, char *name, void *data, int size, int compress)
|
||||||
int
|
int
|
||||||
eet_delete(Eet_File *ef, char *name)
|
eet_delete(Eet_File *ef, char *name)
|
||||||
{
|
{
|
||||||
int hash, node_size;
|
int hash, node_size, i;
|
||||||
int exists_already = 0;
|
int exists_already = 0;
|
||||||
|
|
||||||
/* check to see its' an eet file pointer */
|
/* check to see its' an eet file pointer */
|
||||||
if ((!ef) || (ef->magic != EET_MAGIC_FILE) || (!name))
|
if ((!ef) || (ef->magic != EET_MAGIC_FILE) || (!name))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* deleting keys is only possible in RW mode */
|
||||||
|
if (ef->mode != EET_FILE_MODE_RW) return 0;
|
||||||
|
|
||||||
if (!ef->header) return 0;
|
if (!ef->header) return 0;
|
||||||
|
|
||||||
/* figure hash bucket */
|
/* figure hash bucket */
|
||||||
|
@ -977,9 +984,6 @@ eet_delete(Eet_File *ef, char *name)
|
||||||
node_size = ef->header->directory->hash[hash].size;
|
node_size = ef->header->directory->hash[hash].size;
|
||||||
|
|
||||||
/* Does this node already exist? */
|
/* Does this node already exist? */
|
||||||
if (ef->mode == EET_FILE_MODE_RW)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < node_size; i++)
|
for (i = 0; i < node_size; i++)
|
||||||
{
|
{
|
||||||
/* if it matches */
|
/* if it matches */
|
||||||
|
@ -994,7 +998,6 @@ eet_delete(Eet_File *ef, char *name)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* flags that writes are pending */
|
/* flags that writes are pending */
|
||||||
if (exists_already) ef->writes_pending = 1;
|
if (exists_already) ef->writes_pending = 1;
|
||||||
/* update access time */
|
/* update access time */
|
||||||
|
|
Loading…
Reference in New Issue