From ede72d78b29e0668f6c185232f4bc8f3afaf47ec Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 27 Apr 2013 16:54:09 +0200 Subject: [PATCH] Allow to supply searchpath defines as simple values instead of escaped C strings. --- src/ca65/incpath.c | 2 +- src/cc65/incpath.c | 2 +- src/common/searchpath.h | 4 ++++ src/ld65/filepath.c | 6 +++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ca65/incpath.c b/src/ca65/incpath.c index b69bf2398..ab0db8443 100644 --- a/src/ca65/incpath.c +++ b/src/ca65/incpath.c @@ -73,7 +73,7 @@ void InitIncludePaths (void) /* Add some compiled in search paths if defined at compile time */ #ifdef CA65_INC - AddSearchPath (IncSearchPath, CA65_INC); + AddSearchPath (IncSearchPath, STRINGIZE (CA65_INC)); #endif /* Add specific paths from the environment */ diff --git a/src/cc65/incpath.c b/src/cc65/incpath.c index 8b3596fdd..275fc844d 100644 --- a/src/cc65/incpath.c +++ b/src/cc65/incpath.c @@ -73,7 +73,7 @@ void InitIncludePaths (void) /* Add some compiled in search paths if defined at compile time */ #ifdef CC65_INC - AddSearchPath (SysIncSearchPath, CC65_INC); + AddSearchPath (SysIncSearchPath, STRINGIZE (CC65_INC)); #endif /* Add specific paths from the environment */ diff --git a/src/common/searchpath.h b/src/common/searchpath.h index f9f870563..f162b06ee 100644 --- a/src/common/searchpath.h +++ b/src/common/searchpath.h @@ -48,6 +48,10 @@ +/* Convert argument to C string */ +#define _STRINGIZE(arg) #arg +#define STRINGIZE(arg) _STRINGIZE(arg) + /* A search path is a pointer to the list */ typedef struct Collection SearchPath; diff --git a/src/ld65/filepath.c b/src/ld65/filepath.c index aa7d547e2..efed463ee 100644 --- a/src/ld65/filepath.c +++ b/src/ld65/filepath.c @@ -71,13 +71,13 @@ void InitSearchPaths (void) /* Add some compiled in search paths if defined at compile time */ #if defined(LD65_LIB) - AddSearchPath (LibSearchPath, LD65_LIB); + AddSearchPath (LibSearchPath, STRINGIZE (LD65_LIB)); #endif #if defined(LD65_OBJ) - AddSearchPath (ObjSearchPath, LD65_OBJ); + AddSearchPath (ObjSearchPath, STRINGIZE (LD65_OBJ)); #endif #if defined(LD65_CFG) - AddSearchPath (CfgSearchPath, LD65_CFG); + AddSearchPath (CfgSearchPath, STRINGIZE (LD65_CFG)); #endif /* Add specific paths from the environment */ -- 2.39.5