[Freeciv-Dev] Re: newbie C question
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 5 Mar 2002, Raimar Falke wrote:
> [#10] If an object that has automatic storage duration is
> not initialized explicitly, its value is indeterminate. If
> an object that has static storage duration is not
> initialized explicitly, then:
>
> - if it has pointer type, it is initialized to a null
> pointer;
So,
b = &improvement_types[i];
b->terr_gate = fc_realloc((count + 1) * sizeof(b->terr_gate[0]));
will work, since
struct impr_type improvement_types[B_LAST];
is a global and b->terr_gate is initialized to NULL? That will solve most
of the reloading problems in server/ruleset.c
But only until we drop the assumption that the number of buildings is
constant and we malloc() improvements_types too...
Yours,
Per
"What we anticipate seldom occurs: but what we least expect generally
happens." -- Benjamin Disraeli
- [Freeciv-Dev] Re: newbie C question, (continued)
[Freeciv-Dev] Re: newbie C question, Jules Bean, 2002/03/05
[Freeciv-Dev] Re: newbie C question, Piotr Sulecki, 2002/03/05
[Freeciv-Dev] Re: newbie C question, Reinier Post, 2002/03/06
[Freeciv-Dev] Re: newbie C question, Raimar Falke, 2002/03/05
- [Freeciv-Dev] Re: newbie C question,
Per I. Mathisen <=
|
|