[Freeciv-Dev] Re: DIR_X, DIR_Y patch correction
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Den man, 17 jul 2000 skrev Dirk Stoecker:
> Hi,
>
> The DIR_X, DIR_Y fix is not very clever, as all modules produce a copy of
> this array now, which is really wasted space (nearly every module reports
> static variable unreachable)!
>
> Here the definition of map.h:
> static const int DIR_DX[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
> static const int DIR_DY[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };
>
> change it to:
> IMPORT const int DIR_DX[8];
> IMPORT const int DIR_DY[8];
>
> and add in map.c:
> const int DIR_DX[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
> const int DIR_DY[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };
>
> Now it is really an GLOBAL variable and not an multi-copied local one.
> Normally variable declarations should never be in .h files!
>
> Ciao
Umm, you are rigth.
But shouldn't "IMPORT" be "extern"? At least my K&R makes no mention of
"IMPORT".
-Thue
|
|