[Freeciv-Dev] Re: list cleaning
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 27 Jan 2004, Jason Short wrote:
> However I also don't like delaying the deletion to far. Doing it in an
> end-of-turn loop is ugly, since this removes the clean interface and
> forces the calling code to know about the delayed-deletion mechanism.
The interface is cleaner with *_free(), IMHO, and the calling code does
not have to know anything about the mechanism beneath.
>My
> preference would be for:
>
> - At the end of the loop, if any nodes were deleted iterate through and
> find+remove them.
>
> - As you're iterating through the loop, when you pass a node that's
> deleted remove it.The current problem, IIRC, is with deleting the
> current node since you still need the pointer it provides to get to the
> next node.But at the end of the block when you move on to the next node
> you shouldn't need the current node anymore.
>
> Both of these require a very small ammortized overhead - no more than one
> extra boolean check per loop iteration.So efficiency shouldn't be a
> concern when compared to the delete-at-end-of-turn mechanism.
You forgot: Both require accounting to avoid doing deletions while inside
a nested iterator, and makes necessary a ban on the use of goto and return
from inside an iterator.
- Per
- [Freeciv-Dev] Re: list cleaning, (continued)
- [Freeciv-Dev] Re: list cleaning, Per I. Mathisen, 2004/01/23
- [Freeciv-Dev] Re: list cleaning, Raimar Falke, 2004/01/23
- [Freeciv-Dev] Re: list cleaning, Jason Short, 2004/01/23
- [Freeciv-Dev] Re: list cleaning, Raimar Falke, 2004/01/23
- [Freeciv-Dev] Re: list cleaning, Per I. Mathisen, 2004/01/23
- [Freeciv-Dev] Re: list cleaning, Raimar Falke, 2004/01/26
- [Freeciv-Dev] Re: list cleaning, Per I. Mathisen, 2004/01/26
- [Freeciv-Dev] Re: list cleaning, Raimar Falke, 2004/01/27
- [Freeciv-Dev] Re: list cleaning, Per I. Mathisen, 2004/01/27
- [Freeciv-Dev] Re: list cleaning, Jason Short, 2004/01/27
- [Freeciv-Dev] Re: list cleaning,
Per I. Mathisen <=
- [Freeciv-Dev] Re: list cleaning, Jason Short, 2004/01/27
- [Freeciv-Dev] Re: list cleaning, Raimar Falke, 2004/01/29
- [Freeciv-Dev] Re: list cleaning, Raimar Falke, 2004/01/29
- [Freeciv-Dev] Re: list cleaning, Jason Short, 2004/01/23
|
|