Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] improper access of iterators
Home

[Freeciv-Dev] improper access of iterators

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] improper access of iterators
From: Justin Moore <justin@xxxxxxxxxxx>
Date: Sun, 26 Aug 2001 15:29:01 -0400 (EDT)

   In my quest to improve genlist efficiency I've stumbled across some
improper use of variables within the AI and server code.  Look at
ai/aicity.c:1036.  The unit_list_iterate is defined in terms of the
TYPED_LIST_ITERATE macro in common/genlist.h.  The current macro uses a
genlist_iterator named myiter that the AI and server code references
directly, even though the iterator isn't specifically initialized or even
named within the calling code.

   What are people's thoughts about me migrating from the old genlist to
my new genlist?  My current version of genlist is backwards compatible
with the old one.  The implementation of the ITERATOR_* macros are kind of
hacks and are probably slightly less efficient than the old ones, but I
plan to phase those out if possible.  My idea is to migrate code from the
older, slower genlist data structures and iterators to the newer, faster
ones.  It would be in a few steps.  If people would like more info on
this, I'd be happy to provide it.  I really think we could get a good
performance gain out of a more efficient genlist, but I'd like some
feedback on my ideas.

Thanks.
-jdm

Department of Computer Science, Duke University, Durham, NC 27708-0129
Email:  justin@xxxxxxxxxxx







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