Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: Question about attributes
Home

[Freeciv-Dev] Re: Question about attributes

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Question about attributes
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Jan 2002 12:19:35 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Jan 10, 2002 at 05:53:23AM -0500, Jason Short wrote:
> Raimar Falke wrote:
> 
> 
> > You see the attributes aren't really used. I agree that a seperate
> > attribute_length is the way to go. Please send a patch.
> 
> What about just malloc'ing the buffer in attribute_get?  This saves the 
> extra function call (which will generally always be necessary), at the 
> small cost of having to free the buffer later.

This all depends on the usage patterns. So far we have not enough
users to make a final decision. The agents I have coded so far doesn't
need these attribute_length call at all because they know the size. If
more users like the tile markers are created we may have to rethink
this. Also note that the tile markers in at least one case needs a
slightly larger buffer.

Another solution: attribute_get will allocate a large-enough buffer if
the supplied data pointer is NULL.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Understanding is a three-edged sword; 
  your side, their side, and the truth."
    -- a well-known Vorlon



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