/* deref */
ef->references--;
/* if its still referenced - dont go any further */
- if (ef->references > 0) return EET_ERROR_NONE;
+ if (ef->references > 0) goto on_error;
/* flush any writes */
err = eet_flush2(ef);
/* if not urgent to delete it - dont free it - leave it in cache */
if ((!ef->delete_me_now) && (ef->mode == EET_FILE_MODE_READ))
- {
- if (!locked) UNLOCK_CACHE;
- return EET_ERROR_NONE;
- }
+ goto on_error;
/* remove from cache */
if (ef->mode == EET_FILE_MODE_READ)
eet_cache_del(ef, &eet_writers, &eet_writers_num, &eet_writers_alloc);
/* we can unlock the cache now */
- if (!locked)
- {
- UNLOCK_CACHE;
- }
+ if (!locked) UNLOCK_CACHE;
DESTROY_FILE(ef);
/* free it */
free(ef);
return err;
+
+ on_error:
+ if (!locked) UNLOCK_CACHE;
+ return EET_ERROR_NONE;
}
EAPI Eet_File *