Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: newbie C question
Home

[Freeciv-Dev] Re: newbie C question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: newbie C question
From: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Date: Tue, 5 Mar 2002 14:07:25 +0100 (MET)

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



[Prev in Thread] Current Thread [Next in Thread]