projects
/
super-star-trek.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c4d3d7f
)
allow gcc to still do the bounds checking
author
Stas Sergeev
<stsp@aknet.ru>
Wed, 20 Sep 2006 19:00:34 +0000
(19:00 +0000)
committer
Stas Sergeev
<stsp@aknet.ru>
Wed, 20 Sep 2006 19:00:34 +0000
(19:00 +0000)
src/setup.c
patch
|
blob
|
history
src/sst.h
patch
|
blob
|
history
diff --git
a/src/setup.c
b/src/setup.c
index e4ee63def95f31f8d1baa964333c5b441adb237c..e0ca59da9b9d3c5e3bf76c72cca660eb538b1980 100644
(file)
--- a/
src/setup.c
+++ b/
src/setup.c
@@
-175,8
+175,8
@@
static void setup_names(void)
/* Sets up some arrays with localized names.
* Must be done after iostart() for localization to work. */
{
/* Sets up some arrays with localized names.
* Must be done after iostart() for localization to work. */
{
- char *tmp1[] = SYSTEM_NAMES;
- char *tmp2[] = DEVICE_NAMES;
+ char *tmp1[
ARRAY_SIZE(systnames)
] = SYSTEM_NAMES;
+ char *tmp2[
ARRAY_SIZE(device)
] = DEVICE_NAMES;
memcpy(systnames, tmp1, sizeof(systnames));
memcpy(device, tmp2, sizeof(device));
memcpy(systnames, tmp1, sizeof(systnames));
memcpy(device, tmp2, sizeof(device));
diff --git
a/src/sst.h
b/src/sst.h
index 83e74551da01625dd5bb87e411976f3bb0d4c938..2e6f90994d9ed41a272c73e9c2d4b4b13c447da6 100644
(file)
--- a/
src/sst.h
+++ b/
src/sst.h
@@
-203,6
+203,8
@@
extern double scheduled(int);
#define SSTMAGIC "SST2.0\n"
#define SSTMAGIC "SST2.0\n"
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
struct game {
char magic[sizeof(SSTMAGIC)];
unsigned long options;
struct game {
char magic[sizeof(SSTMAGIC)];
unsigned long options;