From 228b73de10847b41f39c00875528c6986886451a Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 22 Jun 2016 15:57:01 +0100 Subject: [PATCH] Clean up and documentation --- src/codes_memfs.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/codes_memfs.c b/src/codes_memfs.c index a7b4950c5..c404c34e5 100644 --- a/src/codes_memfs.c +++ b/src/codes_memfs.c @@ -11,17 +11,20 @@ #include "grib_api_internal.h" #ifdef HAVE_MEMFS +/* These two functions are implemented in the generated C file memfs.c in the build area */ +/* See the memfs.py Python generator */ int codes_memfs_exists(const char* path); FILE* codes_memfs_open(const char* path); -FILE* codes_fopen(const char* name, const char *mode) { +FILE* codes_fopen(const char* name, const char *mode) +{ FILE *f; if (strcmp(mode, "r") != 0) { return fopen(name, mode); } - f = codes_memfs_open(name); + f = codes_memfs_open(name); /* Load from memory */ if (f) { return f; } @@ -29,12 +32,13 @@ FILE* codes_fopen(const char* name, const char *mode) { return fopen(name, mode); } -int codes_access(const char* name, int mode) { +int codes_access(const char* name, int mode) +{ if (mode != F_OK) { return access(name, mode); } - if (codes_memfs_exists(name)) { + if (codes_memfs_exists(name)) { /* Check memory */ return 0; } @@ -43,13 +47,14 @@ int codes_access(const char* name, int mode) { #else -FILE* codes_fopen(const char* name, const char* mode) { +FILE* codes_fopen(const char* name, const char* mode) +{ return fopen(name, mode); } -int codes_access(const char* name, int mode) { +int codes_access(const char* name, int mode) +{ return access(name, mode); } #endif -