diff options
author | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
commit | f35ed4bbc2b05f1b83476b60948d64375f77f1b4 (patch) | |
tree | 1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/newgrf_config.cpp | |
parent | a332d10fd938f345fff18e5f4a662a58f692f734 (diff) | |
download | openttd-f35ed4bbc2b05f1b83476b60948d64375f77f1b4.tar.xz |
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r-- | src/newgrf_config.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 977cb139e..c624328dd 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -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 @@ GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src) /* 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 @@ static uint ScanPath(const char *path) 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 @@ char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create) 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 @@ static void Load_NGRF(void) 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 @@ static void Load_NGRF(void) AppendStaticGRFConfigs(&_grfconfig); } -const ChunkHandler _newgrf_chunk_handlers[] = { +extern const ChunkHandler _newgrf_chunk_handlers[] = { { 'NGRF', Save_NGRF, Load_NGRF, CH_ARRAY | CH_LAST } }; |