Mercurial > hg > openttd
changeset 9489:8b5f685d3833 draft
(svn r13462) -Codechange: move DriverFactoryBase destructor definition from header file (saves ~16kB)
author | smatz <smatz@openttd.org> |
---|---|
date | Wed, 11 Jun 2008 12:46:28 +0000 |
parents | 9572fb37cb7c |
children | 8622c9315e8c |
files | src/driver.cpp src/driver.h |
diffstat | 2 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/driver.cpp +++ b/src/driver.cpp @@ -183,3 +183,18 @@ return p; } + +/** Frees memory used for this->name + */ +DriverFactoryBase::~DriverFactoryBase() { + if (this->name == NULL) return; + + /* Prefix the name with driver type to make it unique */ + char buf[32]; + strecpy(buf, GetDriverTypeName(type), lastof(buf)); + strecpy(buf + 5, this->name, lastof(buf)); + + GetDrivers().erase(buf); + if (GetDrivers().empty()) delete &GetDrivers(); + free(this->name); +}
--- a/src/driver.h +++ b/src/driver.h @@ -67,20 +67,7 @@ name(NULL) {} - /** Frees memory used for this->name - */ - virtual ~DriverFactoryBase() { - if (this->name == NULL) return; - - /* Prefix the name with driver type to make it unique */ - char buf[32]; - strecpy(buf, GetDriverTypeName(type), lastof(buf)); - strecpy(buf + 5, this->name, lastof(buf)); - - GetDrivers().erase(buf); - if (GetDrivers().empty()) delete &GetDrivers(); - free(this->name); - } + virtual ~DriverFactoryBase(); /** Shuts down all active drivers */