Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Re: (PR#2322) Remove some genlist use
Home

[Freeciv-Dev] Re: (PR#2322) Remove some genlist use

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#2322) Remove some genlist use
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Wed, 13 Nov 2002 09:55:14 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, Nov 13, 2002 at 05:33:51AM -0800, Per I. Mathisen via RT wrote:
> 
> On Wed, 13 Nov 2002, Raimar Falke via RT wrote:
> > The patch converts all plain use of the genlist to use speclist.
> 
> Why?

Speclists are typesafe. Speclists allow you to write

  struct genlist_iterator myiter;

  genlist_iterator_init(&myiter, &This->list, 0);

  for(; ITERATOR_PTR(myiter); ITERATOR_NEXT(myiter))
    if(((struct unit *)ITERATOR_PTR(myiter))->id==id)
      return ITERATOR_PTR(myiter);

as

  unit_list_iterate(*This, punit) {
    if (punit->id == id) {
      return punit;
    }
  } unit_list_iterate_end;

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  reality.sys corrupt. Reboot Universe? (y,n,q)



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