From 7c4307329a52b5954912439959e04e9a8e824ddb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 8 Jan 2015 21:55:05 +0100 Subject: [PATCH] (SDK) Minor cleanups in file_list.c/file_path.c --- libretro-sdk/file/file_list.c | 6 +++--- libretro-sdk/file/file_path.c | 16 +++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/libretro-sdk/file/file_list.c b/libretro-sdk/file/file_list.c index fc06920471..c48fb0690a 100644 --- a/libretro-sdk/file/file_list.c +++ b/libretro-sdk/file/file_list.c @@ -48,9 +48,9 @@ void file_list_push(file_list_t *list, size_t file_list_get_size(const file_list_t *list) { - if (list) - return list->size; - return 0; + if (!list) + return 0; + return list->size; } size_t file_list_get_directory_ptr(const file_list_t *list) diff --git a/libretro-sdk/file/file_path.c b/libretro-sdk/file/file_path.c index 9a02c132b7..146ce4e10a 100644 --- a/libretro-sdk/file/file_path.c +++ b/libretro-sdk/file/file_path.c @@ -69,9 +69,9 @@ const char *path_get_extension(const char *path) { const char *ext = strrchr(path_basename(path), '.'); - if (ext) - return ext + 1; - return ""; + if (!ext) + return ""; + return ext + 1; } char *path_remove_extension(char *path) @@ -144,13 +144,11 @@ bool path_file_exists(const char *path) { FILE *dummy = fopen(path, "rb"); - if (dummy) - { - fclose(dummy); - return true; - } + if (!dummy) + return false; - return false; + fclose(dummy); + return true; } void fill_pathname(char *out_path, const char *in_path,