From 39478f2703895e17f963bd34483a80204033dba6 Mon Sep 17 00:00:00 2001 From: cuz Date: Sun, 3 Aug 2003 11:51:12 +0000 Subject: [PATCH] New function ForgetAllSearchPaths git-svn-id: svn://svn.cc65.org/cc65/trunk@2242 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/common/searchpath.c | 15 +++++++++++++++ src/common/searchpath.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/common/searchpath.c b/src/common/searchpath.c index e8883f63c..7ae0a96ef 100644 --- a/src/common/searchpath.c +++ b/src/common/searchpath.c @@ -179,6 +179,21 @@ void AddSearchPathFromEnv (const char* EnvVar, unsigned Where) +void ForgetAllSearchPaths (unsigned Where) +/* Forget all search paths in the given lists. */ +{ + unsigned I; + for (I = 0; I < MAX_SEARCH_PATHS; ++I) { + unsigned Mask = (0x01U << I); + if (Where & Mask) { + xfree (SearchPaths[I]); + SearchPaths[I] = 0; + } + } +} + + + char* SearchFile (const char* Name, unsigned Where) /* Search for a file in a list of directories. Return a pointer to a malloced * area that contains the complete path, if found, return 0 otherwise. diff --git a/src/common/searchpath.h b/src/common/searchpath.h index 0e51e1963..053301651 100644 --- a/src/common/searchpath.h +++ b/src/common/searchpath.h @@ -69,6 +69,9 @@ void AddSearchPath (const char* NewPath, unsigned Where); void AddSearchPathFromEnv (const char* EnvVar, unsigned Where); /* Add a search from an environment variable */ +void ForgetAllSearchPaths (unsigned Where); +/* Forget all search paths in the given lists. */ + char* SearchFile (const char* Name, unsigned Where); /* Search for a file in a list of directories. Return a pointer to a malloced * area that contains the complete path, if found, return 0 otherwise. -- 2.39.5