? client/options.c.pdz ? server/stdinhand.c.pdz Index: client/options.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/options.c,v retrieving revision 1.40 diff -u -r1.40 options.c --- client/options.c 2001/07/04 11:24:19 1.40 +++ client/options.c 2001/09/06 19:39:08 @@ -189,7 +189,7 @@ for(i=0; i= 0 && result < sizeof(descriptions)/sizeof(descriptions[0])); + assert(result >= 0 && result < ARRAY_SIZE(descriptions)); return descriptions[result]; } Index: common/shared.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v retrieving revision 1.85 diff -u -r1.85 shared.h --- common/shared.h 2000/09/22 07:24:24 1.85 +++ common/shared.h 2001/09/06 19:39:09 @@ -57,6 +57,8 @@ /* This is duplicated in rand.h to avoid extra includes: */ #define MAX_UINT32 0xFFFFFFFF +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + char *create_centered_string(char *s); char * get_option(const char *option_name,char **argv,int *i,int argc); Index: common/tech.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/tech.c,v retrieving revision 1.28 diff -u -r1.28 tech.c --- common/tech.c 2001/09/02 13:37:58 1.28 +++ common/tech.c 2001/09/06 19:39:09 @@ -18,6 +18,7 @@ #include "game.h" #include "player.h" #include "support.h" +#include "shared.h" /* ARRAY_SIZE */ #include "tech.h" @@ -190,7 +191,7 @@ { enum tech_flag_id i; - assert(sizeof(flag_names)/sizeof(char*)==TF_LAST); + assert(ARRAY_SIZE(flag_names)==TF_LAST); for(i=0; igovernment), get_nation_name_plural (pplayer->nation)); - for (inx = 0; inx < (sizeof (keytable) / sizeof (keytable[0])); inx++) + for (inx = 0; inx < ARRAY_SIZE(keytable); inx++) { if ((strchr (game.demography, keytable[inx].key)) && (keytable[inx].flag == DEM_ROW)) Index: server/rulesout.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/rulesout.c,v retrieving revision 1.3 diff -u -r1.3 rulesout.c --- server/rulesout.c 2000/08/31 13:32:49 1.3 +++ server/rulesout.c 2001/09/06 19:39:09 @@ -151,7 +151,7 @@ } /* Flags: */ - for(j=0; j