Author: muggenhor Date: Fri Jul 25 22:27:54 2008 New Revision: 5666 URL: http://svn.gna.org/viewcvs/warzone?rev=5666&view=rev Log: Further hardcode the treap management code to the string resource system: * Don't maintain a secondary linked list of strings in strres.c * Add the string that's tracked and it's ID number to the TREAP_NODE structure * Let the treap code manage its own memory * Have the treap code perform reverse lookups using either the resource string (i.e. not the "key" string) or associated ID number
NOTE: Searching a treap for anything else than the key is O(n), but that's no worse than a linked list, which is O(n) as well. Walking a treap has O(log n) as memory requirement, whereas walking a linked list has O(1) as memory requirement (stack size). So the only disadvantage is that searching the treap has a (highly remote!) possibility of stack overflows. Modified: trunk/lib/framework/strres.c trunk/lib/framework/strres.h trunk/lib/framework/treap.c trunk/lib/framework/treap.h trunk/src/scriptobj.c _______________________________________________ Warzone-commits mailing list Warzone-commits@gna.org https://mail.gna.org/listinfo/warzone-commits