Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] (PR#11779) New genlist code
Home

[Freeciv-Dev] (PR#11779) New genlist code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11779) New genlist code
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 3 Jan 2005 12:24:41 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11779 >

This is the new genlist code I've been whispering about in the corners for
some time. It is not finished yet (still some valgrind warnings to track
down, and a strange delay on quit), but it is at a 'needs comments' stage.

In short:
 - nodes in the linked list are not deleted at once, but marked as deleted
 - a master list called the tracker points to all lists
 - new listname_list_free() method
 - renamed listname_list_init(list) to *listname_list_new()
 - when genlists_prune() is called from high-level code, all lists are
   pruned for nodes marked as deleted
 - genlists are now pointers instead of allocated on the stack, hence
   no more
        struct genlist mylist;
   but
        struct genlist *mylist;

This way of doing genlists is inherently safer, as deletion of the next
node by called code (which is why we have unit_list_iterate_safe) is
unproblematic.

  - Per

Attachment: genlist1.diff.gz
Description: application/gunzip


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