﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
221	psListGet/psListAdd/psListRemove maybe should just use psListIterator instead of location	robert.desonia@…	Paul Price	"It is fairly inefficient to index into a list by number, so I was wondering if
it wouldn't be better to write functions like psListGet, etc., to only use
iterators and make the 'head' and 'tail' attributes of psList simply
psListIterators as well.  Here is what I'm proposing:

typedef struct {
    psU32 size;
    const psListIterator* head;
    const psListIterator* tail;
    psArray* iterators;
    pthread_mutex_t lock;
} psList;

void* psListGet(const psListIterator* iter);
bool psListRemove(const psListIterator* iter);

To add an item to the front of the list, do:
    psListAddBefore(list->head,di);
or on the at the end:
    psListAddAfter(list->tail,di);

To get the head data item:
    di = psListGet(list->head);

To get the fourth item, a user would need to make their own psListIterator, but
given that it is not very efficient to repeatedly index into the list by number,
as would likely be the tendency of the user to do, this is probably a much more
preferable option.
   iter = psListIteratorAlloc(list,4);
   di = psListGet(iter);

Of course, functions that change the psListIterator, like psGetNext, would
protect the head and tail iterators.
-rdd"	defect	closed	high		PSLib SDRS	unspecified	normal	fixed		
