Mercurial > molko
diff src/libmlk-rpg/rpg/map-file.c @ 428:26d23999a54b
core: get rid of zfile
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 15 Oct 2022 14:38:15 +0200 |
parents | 7d2ebc334c8c |
children | 8f59201dc76b |
line wrap: on
line diff
--- a/src/libmlk-rpg/rpg/map-file.c Sat Oct 15 14:19:58 2022 +0200 +++ b/src/libmlk-rpg/rpg/map-file.c Sat Oct 15 14:38:15 2022 +0200 @@ -30,7 +30,6 @@ #include <core/error.h> #include <core/image.h> #include <core/trace.h> -#include <core/zfile.h> #include "map-file.h" @@ -272,30 +271,26 @@ .mf = file, .map = map, }; - struct zfile zf; int ret = 0; memset(map, 0, sizeof (*map)); - alloc_pool_init(&file->blocks, sizeof (*map->blocks), NULL); - if (zfile_open(&zf, path) < 0) + if (!(ctx.fp = fopen(path, "r"))) goto fail; - - ctx.fp = zf.fp; - if ((ret = parse(&ctx, path)) < 0 || (ret = check(map)) < 0) goto fail; - zfile_close(&zf); + fclose(ctx.fp); return 0; fail: - errorf("%s: %s", path, strerror(errno)); map_finish(map); map_file_finish(file); - zfile_close(&zf); + + if (ctx.fp) + fclose(ctx.fp); return -1; }