From 341b1b4d15edcfd35ad4551d06f2402aae9a89a3 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 14 May 2015 09:27:05 +0200 Subject: [PATCH] Improve portability to really outmoded compilers A few modernisms have crept in: * Trailing comma in enum definition (commit 71320ed, v4.3.10) * // comment (commit 265e71e, v4.3.11) * (commit 9102ecc, v4.3.31) MSC actually chokes on this one. Avoid them. Signed-off-by: Markus Armbruster --- include/optlist.h | 2 +- src/lib/gen/chance.c | 11 +++++++---- src/lib/update/sect.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/optlist.h b/include/optlist.h index b87873ce6..676fabcc9 100644 --- a/include/optlist.h +++ b/include/optlist.h @@ -64,7 +64,7 @@ enum { enum { UPD_DEMAND_NONE, /* no demand updates */ UPD_DEMAND_SCHED, /* scheduled updates are demand updates */ - UPD_DEMAND_ASYNC, /* zdone triggers unscheduled update */ + UPD_DEMAND_ASYNC /* zdone triggers unscheduled update */ }; struct keymatch { diff --git a/src/lib/gen/chance.c b/src/lib/gen/chance.c index 210e8e8b3..b20dfb9bd 100644 --- a/src/lib/gen/chance.c +++ b/src/lib/gen/chance.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -120,8 +119,12 @@ seed_prng(unsigned seed) init_genrand(seed); } -static uint32_t -djb_hash(uint32_t hash, void *buf, size_t sz) +/* + * Note: this is DJB's hash function when unsigned is 32 bits and hash + * is initially 5381. + */ +static unsigned +djb_hash(unsigned hash, void *buf, size_t sz) { unsigned char *bp; @@ -138,7 +141,7 @@ unsigned pick_seed(void) { int fd; - uint32_t seed; + unsigned seed; int got_seed = 0; struct timeval tv; pid_t pid; diff --git a/src/lib/update/sect.c b/src/lib/update/sect.c index f82471d75..e6c6269cb 100644 --- a/src/lib/update/sect.c +++ b/src/lib/update/sect.c @@ -78,7 +78,7 @@ upd_buildeff(struct natstr *np, struct sctstr *sp, int *workp, neweff = n; *cost += work_cost; if (!n && IS_BIG_CITY(old_type) && !IS_BIG_CITY(*desig)) { - // FIXME use trunc_people() and total_work() + /* FIXME use trunc_people() and total_work() */ int maxpop = max_population(np->nat_level[NAT_RLEV], *desig, n); if (vec[I_CIVIL] > maxpop) vec[I_CIVIL] = maxpop; -- 2.43.0