From d04864103e3fccd85a9f3f619ebd277306dc39a8 Mon Sep 17 00:00:00 2001 From: kai Date: Fri, 8 Mar 2013 06:53:12 +0100 Subject: [PATCH] Use the new Port::stricmp() method. --- dmd2/module.c | 14 ++++---------- dmd2/root/port.c | 4 ++-- driver/main.cpp | 26 ++++++++++---------------- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/dmd2/module.c b/dmd2/module.c index 2cf024af..98a6f7bf 100644 --- a/dmd2/module.c +++ b/dmd2/module.c @@ -40,12 +40,6 @@ #include "llvm/Support/CommandLine.h" #include -#if _WIN32 -#define strcasecmp(s1, s2) _stricmp(s1, s2) -#else -#define strcasecmp(s1, s2) strcmp(s1, s2) -#endif - static llvm::cl::opt preservePaths("op", llvm::cl::desc("Do not strip paths from source file"), llvm::cl::ZeroOrMore); @@ -213,7 +207,7 @@ File* Module::buildFilePath(const char* forcename, const char* path, const char* // allow for .o and .obj on windows #if _WIN32 if (ext == global.params.objdir && FileName::ext(argobj) - && strcasecmp(FileName::ext(argobj), global.obj_ext_alt) == 0) + && Port::stricmp(FileName::ext(argobj), global.obj_ext_alt) == 0) return new File((char*)argobj); #endif return new File(FileName::forceExt(argobj, ext)); @@ -313,17 +307,17 @@ void Module::buildTargetFiles(bool singleObj) hdrfile = Module::buildFilePath(global.params.hdrname, global.params.hdrdir, global.hdr_ext); // safety check: never allow obj, doc or hdr file to have the source file's name - if(strcasecmp(FileName::name(objfile->name->str), FileName::name((char*)this->arg)) == 0) + if(Port::stricmp(FileName::name(objfile->name->str), FileName::name((char*)this->arg)) == 0) { error("Output object files with the same name as the source file are forbidden"); fatal(); } - if(docfile && strcasecmp(FileName::name(docfile->name->str), FileName::name((char*)this->arg)) == 0) + if(docfile && Port::stricmp(FileName::name(docfile->name->str), FileName::name((char*)this->arg)) == 0) { error("Output doc files with the same name as the source file are forbidden"); fatal(); } - if(hdrfile && strcasecmp(FileName::name(hdrfile->name->str), FileName::name((char*)this->arg)) == 0) + if(hdrfile && Port::stricmp(FileName::name(hdrfile->name->str), FileName::name((char*)this->arg)) == 0) { error("Output header files with the same name as the source file are forbidden"); fatal(); diff --git a/dmd2/root/port.c b/dmd2/root/port.c index 820a36e8..b634b924 100644 --- a/dmd2/root/port.c +++ b/dmd2/root/port.c @@ -340,12 +340,12 @@ char *Port::strupr(char *s) int Port::memicmp(const char *s1, const char *s2, int n) { - return ::memicmp(s1, s2, n); + return ::_memicmp(s1, s2, n); } int Port::stricmp(const char *s1, const char *s2) { - return ::stricmp(s1, s2); + return ::_stricmp(s1, s2); } #endif diff --git a/driver/main.cpp b/driver/main.cpp index 2310ca12..202e46c9 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -51,12 +51,6 @@ #include #endif -#if _WIN32 -#define strcasecmp(s1, s2) _stricmp(s1, s2) -#else -#define strcasecmp(s1, s2) strcmp(s1, s2) -#endif - // Needs Type already declared. #include "cond.h" @@ -806,9 +800,9 @@ int main(int argc, char** argv) if (strcmp(ext, global.obj_ext) == 0 || strcmp(ext, global.bc_ext) == 0) #else - if (strcasecmp(ext, global.obj_ext) == 0 || - strcasecmp(ext, global.obj_ext_alt) == 0 || - strcasecmp(ext, global.bc_ext) == 0) + if (Port::stricmp(ext, global.obj_ext) == 0 || + Port::stricmp(ext, global.obj_ext_alt) == 0 || + Port::stricmp(ext, global.bc_ext) == 0) #endif { global.params.objfiles->push(static_cast(files.data[i])); @@ -818,9 +812,9 @@ int main(int argc, char** argv) #if POSIX if (strcmp(ext, "a") == 0) #elif __MINGW32__ - if (stricmp(ext, "a") == 0) + if (Port::stricmp(ext, "a") == 0) #else - if (strcasecmp(ext, "lib") == 0) + if (Port::stricmp(ext, "lib") == 0) #endif { global.params.libfiles->push(static_cast(files.data[i])); @@ -841,27 +835,27 @@ int main(int argc, char** argv) } #if !POSIX - if (strcasecmp(ext, "res") == 0) + if (Port::stricmp(ext, "res") == 0) { global.params.resfile = static_cast(files.data[i]); continue; } - if (strcasecmp(ext, "def") == 0) + if (Port::stricmp(ext, "def") == 0) { global.params.deffile = static_cast(files.data[i]); continue; } - if (strcasecmp(ext, "exe") == 0) + if (Port::stricmp(ext, "exe") == 0) { global.params.exefile = static_cast(files.data[i]); continue; } #endif - if (strcasecmp(ext, global.mars_ext) == 0 || - strcasecmp(ext, global.hdr_ext) == 0) + if (Port::stricmp(ext, global.mars_ext) == 0 || + Port::stricmp(ext, global.hdr_ext) == 0) { ext--; // skip onto '.' assert(*ext == '.');