src/newgrf_config.cpp
changeset 5587 167d9a91ef02
parent 5584 1111b4d36e35
child 5609 dc6a58930ba4
--- a/src/newgrf_config.cpp	Wed Jan 10 18:44:52 2007 +0000
+++ b/src/newgrf_config.cpp	Wed Jan 10 18:56:51 2007 +0000
@@ -12,6 +12,7 @@
 #include "network/network_data.h"
 #include "newgrf.h"
 #include "newgrf_config.h"
+#include "helpers.hpp"
 
 #include "fileio.h"
 #include "fios.h"
@@ -123,7 +124,7 @@
 	/* Clear destination as it will be overwritten */
 	ClearGRFConfigList(dst);
 	for (; src != NULL; src = src->next) {
-		c = calloc(1, sizeof(*c));
+		CallocT(&c, 1);
 		*c = *src;
 		if (src->filename != NULL) c->filename = strdup(src->filename);
 		if (src->name     != NULL) c->name     = strdup(src->name);
@@ -269,7 +270,7 @@
 			if (ext == NULL) continue;
 			if (strcasecmp(ext, ".grf") != 0) continue;
 
-			c = calloc(1, sizeof(*c));
+			CallocT(&c, 1);
 			c->filename = strdup(file);
 
 			if (FillGRFDetails(c, false)) {
@@ -374,7 +375,7 @@
 
 	if (!create) return NULL;
 
-	grf = calloc(1, sizeof(*grf));
+	CallocT(&grf, 1);
 	grf->grfid = grfid;
 	grf->next  = unknown_grfs;
 	ttd_strlcpy(grf->name, UNKNOWN_GRF_NAME_PLACEHOLDER, sizeof(grf->name));
@@ -445,7 +446,8 @@
 	GRFConfig **last = &first;
 
 	while (SlIterateArray() != -1) {
-		GRFConfig *c = calloc(1, sizeof(*c));
+		GRFConfig *c;
+		CallocT(&c, 1);
 		SlObject(c, _grfconfig_desc);
 
 		/* Append our configuration to the list */
@@ -461,7 +463,7 @@
 	AppendStaticGRFConfigs(&_grfconfig);
 }
 
-const ChunkHandler _newgrf_chunk_handlers[] = {
+extern const ChunkHandler _newgrf_chunk_handlers[] = {
 	{ 'NGRF', Save_NGRF, Load_NGRF, CH_ARRAY | CH_LAST }
 };