aboutsummaryrefslogtreecommitdiff
path: root/src/file_posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_posix.c')
-rw-r--r--src/file_posix.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/file_posix.c b/src/file_posix.c
index e6915a5..9b61c01 100644
--- a/src/file_posix.c
+++ b/src/file_posix.c
@@ -19,7 +19,7 @@ static const bh_io_table_t bh_file_table = {
(bh_off_t (*)(struct bh_io_s *)) bh_file_tell_base,
(bh_off_t (*)(struct bh_io_s *)) bh_file_available_base,
(void (*)(struct bh_io_s *)) bh_file_clear_base,
- (void (*)(struct bh_io_s *)) bh_file_destroy
+ (void (*)(struct bh_io_s *)) bh_file_destroy_base
};
bh_file_t *bh_file_new(const char *path)
@@ -38,12 +38,6 @@ bh_file_t *bh_file_new(const char *path)
return result;
}
-void bh_file_free(bh_file_t *file)
-{
- bh_file_destroy(file);
- free(file);
-}
-
int bh_file_init(bh_file_t *file,
const char *path)
{
@@ -51,8 +45,8 @@ int bh_file_init(bh_file_t *file,
if (!path)
return BH_INVALID;
- /* Initialize base io object */
- bh_io_init(&file->base, &bh_file_table);
+ /* Initialize underlying io object */
+ bh_io_init(&file->base, &bh_file_table, 1);
/* Initialize file io object */
file->handle = -1;
@@ -62,11 +56,12 @@ int bh_file_init(bh_file_t *file,
return BH_OK;
}
-void bh_file_destroy(bh_file_t *file)
+void bh_file_destroy_base(bh_file_t *file)
{
/* Close the file */
bh_file_close(file);
free(file->path);
+ bh_io_destroy_base(&file->base);
}
int bh_file_open_base(bh_file_t *file,