starting to see diminishing returns.

This commit is contained in:
Enno Rehling 2018-12-15 20:12:53 +01:00
parent 484945d42a
commit 2a96fffeb5
4 changed files with 13 additions and 3 deletions

View File

@ -65,8 +65,11 @@ static building_type *setup_castle(item_type *it_stone) {
btype = test_create_buildingtype("castle");
stage = btype->stages = calloc(1, sizeof(building_stage));
if (!stage) abort();
cons = stage->construction = calloc(1, sizeof(construction));
if (!cons) abort();
cons->materials = calloc(2, sizeof(requirement));
if (!cons->materials) abort();
cons->materials[0].number = 1;
cons->materials[0].rtype = it_stone->rtype;
cons->minskill = 1;
@ -74,8 +77,11 @@ static building_type *setup_castle(item_type *it_stone) {
cons->reqsize = 1;
cons->skill = SK_BUILDING;
stage = stage->next = calloc(1, sizeof(building_stage));
if (!stage) abort();
cons = stage->construction = calloc(1, sizeof(construction));
if (!cons) abort();
cons->materials = calloc(2, sizeof(requirement));
if (!cons->materials) abort();
cons->materials[0].number = 1;
cons->materials[0].rtype = it_stone->rtype;
cons->minskill = 1;

View File

@ -19,7 +19,8 @@ const char *eressea_version(void) {
}
int version_no(const char *str) {
int maj = 0, min = 0, pat = 0;
sscanf(str, "%4d.%4d.%4d", &maj, &min, &pat);
int c, maj = 0, min = 0, pat = 0;
c = sscanf(str, "%4d.%4d.%4d", &maj, &min, &pat);
assert(c == 3);
return (maj << 16) | (min << 8) | pat;
}

View File

@ -277,6 +277,7 @@ void test_create_calendar(void) {
config_set_int("game.start", 184);
months_per_year = 9;
month_season = malloc(sizeof(int) * months_per_year);
if (!month_season) abort();
month_season[0] = SEASON_SUMMER;
month_season[1] = SEASON_AUTUMN;
month_season[2] = SEASON_AUTUMN;

View File

@ -250,7 +250,9 @@ char *__crypt_gensalt_ra(const char *prefix, unsigned long count,
if (!dst)
__set_errno(ENOMEM);
#endif
retval = memcpy(dst, retval, len);
if (dst) {
retval = memcpy(dst, retval, len);
}
}
return retval;