diff options
author | smatz <smatz@openttd.org> | 2008-06-24 09:15:45 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-06-24 09:15:45 +0000 |
commit | 96d880ea9e91f9c9bdbc2a25918122ad382be97c (patch) | |
tree | 434b9d9480c094ea3ab6aebd08d1b5005f4bcc1e /src/blitter/factory.hpp | |
parent | 40d5242f919824f37d533360af8d7ab6ad0b4722 (diff) | |
download | openttd-96d880ea9e91f9c9bdbc2a25918122ad382be97c.tar.xz |
(svn r13619) -Codechange: use 'const char *' instead of std::string for blitter and driver names
Removes indirect dependency on <string> for 20 files, reduces binary size by 16kB
Diffstat (limited to 'src/blitter/factory.hpp')
-rw-r--r-- | src/blitter/factory.hpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp index 928b78547..b33c9e5a9 100644 --- a/src/blitter/factory.hpp +++ b/src/blitter/factory.hpp @@ -8,7 +8,6 @@ #include "base.hpp" #include "../debug.h" #include "../string_func.h" -#include <string> #include <map> /** @@ -16,8 +15,16 @@ */ class BlitterFactoryBase { private: - char *name; - typedef std::map<std::string, BlitterFactoryBase *> Blitters; + const char *name; + + struct StringCompare { + bool operator () (const char *a, const char *b) const + { + return strcmp(a, b) < 0; + } + }; + + typedef std::map<const char *, BlitterFactoryBase *, StringCompare> Blitters; static Blitters &GetBlitters() { @@ -58,7 +65,7 @@ public: if (this->name == NULL) return; GetBlitters().erase(this->name); if (GetBlitters().empty()) delete &GetBlitters(); - free(this->name); + free((void *)this->name); } /** |