HTList enhancement

In using w3c-libwww-5.2.8, we noticed an opportunity for enhancement in
the implementation of HTList.

The idea is to provide new versions of HTList_appendObject and
HTList_addObject which returns a pointer to the new HTList added or
appended.  This allows one to keep a reference to the end of the list
outside of the list itself, which can be used to speed up certain list
operations.

HTList.c


     PUBLIC HTList * HTList_addList (HTList * me, void * newObject)

     {
         if (me) {
             HTList *newNode;
             if ((newNode = (HTList  *) HT_CALLOC(1,
     sizeof(HTList))) == NULL)
                 HT_OUTOFMEM("HTList_addObject");
             newNode->object = newObject;
             newNode->next = me->next;
             me->next = newNode;
             return newNode;
         } else {
             HTTRACE(CORE_TRACE, "HTList...... Can not add object
     %p to nonexisting List\n
     " _
                         newObject);
         }
         return (HTList *) NULL;
     }

     PUBLIC HTList * HTList_appendList (HTList * me, void *
     newObject)
     {
         if (me) {
             while (me->next) me = me->next;
             return HTList_addList(me, newObject);
         }
         return (HTList *) NULL;
     }

These functions require two further modifications to publish these new
entry points.

HTList.h


     extern HTList * HTList_addList (HTList * me, void *
     newObject);
     extern HTList * HTList_appendList (HTList * me, void *
     newObject);


wwwutils.def


     HTList_addList          @ 518
     HTList_appendList       @ 519


more,
l8r,

 ------------------------------------------------------------------
 Victor Bancroft
 Fellow, Artificial Intelligence Center              (706) 542-0358
 Athens, Georgia  30602, U.S.A          http://ai.uga.edu/~bancroft
 Senior Software Engineer, Business Technology Group (404) 231-5520
                                                 FAX (404) 231-5377

Received on Friday, 14 January 2000 10:26:28 UTC