Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: Split patch (was Re: [RFC PATCH] init_techs)
Home

[Freeciv-Dev] Re: Split patch (was Re: [RFC PATCH] init_techs)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Subject: [Freeciv-Dev] Re: Split patch (was Re: [RFC PATCH] init_techs)
From: Reinier Post <rp@xxxxxxxxxx>
Date: Fri, 28 Sep 2001 09:05:38 +0200

On Fri, Sep 28, 2001 at 12:00:07AM -0400, Ross W. Wetmore wrote:
> I like your statement of what you claim to be agreeing to followed
> by what you actually want to do in practice.
> 
> Why on earth would you handle the same buffer contents 3 times with
> all those allocation and free calls when you could do it once and
> let the caller deal with at most one extra copy depending on whether
> the original buffer or the results needed to be preserved.
> 
> But most of the time I would expect that no extra copies were required
> in the caller algorithms.
> 
> split should treat the buffer it was handed as working memory, return
> pointers into the parsed string elements, and let the caller deal with
> ALL memory issues.
> 
> It is really the only sensible general purpose solution for something 
> like this.

Only if you do not have to expand the input while tokenizing it.
Then you can change whitespace to NUL a la strtok() either on the
original or on a copy.  I think Freeciv will meets this case
regardless of the extended command syntax Justin decides on.

-- 
Reinier


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