Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand
Home

[Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand
From: Justin Moore <justin@xxxxxxxxxxx>
Date: Tue, 21 Aug 2001 10:23:14 -0400 (EDT)

> > struct sortlist_link {
> >   void *dataptr;
> > };
> >
> > struct sortlist {
> >   int capacity;
> >   int num_links;
> >   struct sortlist_link *data;
> > };
>
> Why not just:?
>
> > struct sortlist {
> >   int capacity;
> >   int num_links;
> >   void *data;
> > };
>
> If you remove the extra indirection and the sorting we have a
> dynamically sized array. What do you think about this?

   That works, too.  The only reason I had for doing it the way I did was
for slightly easier migration of the code from genlists to sortlists.  I
wasn't sure of all the possible contexts that genlists were used and how
difficult it would be to update it, so I had the sortlist API and
(somewhat) visible layer mirror genlist.

   I'll make the changes and start hunting around for some replacement
candidates.

>  "I was dead ... but I'm better now."
>     -- Capitain Sheridan in Babylon 5

   "I feel HAPPY!!!"
   -- MP&THG

-jdm

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



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