Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: list cleaning
Home

[Freeciv-Dev] Re: list cleaning

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: list cleaning
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 29 Nov 2003 15:05:51 +0000 (GMT)

On Sat, 29 Nov 2003, Vasco Alexandre Da Silva Costa wrote:
> > > genlists. When genlist_prune() is called, it cleans every registered list.
> > > This way we can be certain that lists are only cleaned a limited number of
> > > times and only when it is guaranteed safe to do so.
> >
> > This is possible to achieve faster code. Another idea is to use a bool
> > flag in the genlist which is set to TRUE when a node is deleted and to
> > FALSE after prune got called. prune will only be called if this
> > deleted field is TRUE.
>
> The modified version of Per's code I have already does this, but I still
> need to fix the iterations. Now that delta is in CVS, I can resume work
> on that.

This is not a bad idea, however you still need to ensure that the lists
are always normalized (prohibit goto and return inside iterators).

It is also a few additional instructions on each iterator end...

With my approach, you don't need to change the iterators, avoid the demand
that all future iterators are 'normalized' and it is the fastest way.

  - Per



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