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]
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Question about attributes
From: Jason Short <vze2zq63@xxxxxxxxxxx>
Date: Thu, 10 Jan 2002 06:37:38 -0500
Reply-to: jdorje@xxxxxxxxxxxx

Raimar Falke wrote:

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.

Interesting. Keep in mind that this data is unverified; if you connect to a server in place of some former player, and that player has uploaded invalid attributes, your client should not die. So it is important that error-checking be done in all cases.


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

And return a pointer to the buffer? Or will the user pass in a pointer-to-pointer? Either seems like a reasonable solution.

jason



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