From ac56d468c81e1ab25b32f5e1ddca6b867e386a93 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Sat, 14 Mar 2009 21:00:59 +0100 Subject: [PATCH] added _noerror version of functions --- lib/as3/files.c | 7 +++++-- lib/as3/files.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/as3/files.c b/lib/as3/files.c index 5cd1e2e..6e75fd7 100644 --- a/lib/as3/files.c +++ b/lib/as3/files.c @@ -201,7 +201,7 @@ char is_absolute(const char*filename) return 0; } -char*find_file(const char*filename) +char*find_file(const char*filename, char error) { include_dir_t*i = current_include_dirs; FILE*fi = 0; @@ -212,7 +212,7 @@ char*find_file(const char*filename) return strdup(filename); } } else { - if(!i) { + if(!i && error) { as3_warning("Include directory stack is empty, while looking for file %s", filename); } while(i) { @@ -227,6 +227,9 @@ char*find_file(const char*filename) i = i->next; } } + if(!error) { + return 0; + } as3_error("Couldn't find file %s", filename); i = current_include_dirs; diff --git a/lib/as3/files.h b/lib/as3/files.h index ae31212..8af24b7 100644 --- a/lib/as3/files.h +++ b/lib/as3/files.h @@ -35,7 +35,7 @@ extern include_dir_t* current_include_dirs; void add_include_dir(char*dir); -char*find_file(const char*filename); +char*find_file(const char*filename, char report_errors); void enter_file(const char*name, const char*filename, void*state); FILE* enter_file2(const char*name, const char*filename, void*state); void* leave_file(); -- 1.7.10.4