From 3ebcfad8c0441fafa804ba2a514071330dc695d5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 21 Mar 2015 09:31:07 +0100 Subject: [PATCH] (file_ops.c) Simplify read_file --- file_ops.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/file_ops.c b/file_ops.c index 79409257e9..683eb51347 100644 --- a/file_ops.c +++ b/file_ops.c @@ -85,7 +85,7 @@ bool write_file(const char *path, const void *data, ssize_t size) * * Returns: number of items read, -1 on error. */ -static bool read_generic_file(const char *path, void **buf, ssize_t *len) +static int read_generic_file(const char *path, void **buf, ssize_t *len) { long ret = 0, _len = 0; void *rom_buf = NULL; @@ -127,7 +127,7 @@ static bool read_generic_file(const char *path, void **buf, ssize_t *len) if (len) *len = ret; - return true; + return 1; error: if (file) @@ -137,7 +137,7 @@ error: if (len) *len = -1; *buf = NULL; - return false; + return 0; } #ifdef HAVE_COMPRESSION @@ -240,7 +240,5 @@ int read_file(const char *path, void **buf, ssize_t *length) if (read_compressed_file(path, buf, NULL, length)) return true; #endif - if (read_generic_file(path, buf, length)) - return 1; - return 0; + return read_generic_file(path, buf, length); }