W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2000

do I really understand this or not ?

From: Gregory Nicholls <gnicholls@level8.com>
Date: Thu, 08 Jun 2000 15:00:01 -0400
Message-ID: <393FED31.15CDE749@level8.com>
To: www-lib@w3.org
Hi,
 I've found something odd with the HTList_firstObject() function. My
read on this is that it should return a pointer to the first object in
the list. Running some tests shows that this doesn't happen.
  After looking at the source it seems (to my naive eye) that this
routine will always return NULL.
    Here's the source I have with a mod that I put in to make it work
the way I _think_ it's supposed to.
Could someone more knowledgable please comment on this please ?

    Thanks,
        G
--------------- snip -----------------------
PUBLIC void * HTList_firstObject  (HTList * me)
{
/* This is the original code
    if (me && me->next) {
        HTList * prevNode;
        while (me->next) {
            prevNode = me;
            me = me->next;
        }
        return me->object;
    } else
        return NULL;
*/
/* This is my new stuff */
    if (me && me->next)
     {
      return me->next->object;
     }
    return NULL;
}
Received on Thursday, 8 June 2000 14:57:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:36 GMT