Changeset - r9489:7a345541bc8e
[Not reviewed]
master
0 2 0
smatz - 16 years ago 2008-06-11 12:46:28
smatz@openttd.org
(svn r13462) -Codechange: move DriverFactoryBase destructor definition from header file (saves ~16kB)
2 files changed with 16 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/driver.cpp
Show inline comments
 
@@ -183,3 +183,18 @@ char *DriverFactoryBase::GetDriversInfo(
 

	
 
	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);
 
}
src/driver.h
Show inline comments
 
@@ -67,20 +67,7 @@ public:
 
		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
 
	 */
0 comments (0 inline, 0 general)