That's what I was going to do. Fantastic, my idea was not way out there. Thanks.
> -----Original Message----- > From: Mike Barton [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 21, 2003 2:17 PM > To: Jason Gauthier; '[email protected]' > Subject: Re: Removing linked lists items. > > > I had a similar problem. I wound up putting a boolean in the > structure that > made up the linked list, and just flagging it as true in the > loop if it > needed to be deleted. Then after that loop, I go through a > second "normal" > loop and remove all of those that are flagged. > > On Tuesday 21 October 2003 01:13 pm, Jason Gauthier wrote: > > With the exception that what's removed might not be in > order. Could be > > at the front, middle and end of the list. > > > > This would cause items to get skipped in the loop. If there is no > > practical way I can work around it. > > > > > -----Original Message----- > > > From: Jed Yang [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, October 21, 2003 10:44 AM > > > To: Jason Gauthier; [email protected] > > > Subject: Re: Removing linked lists items. > > > > > > > > > Maybe you can let the function pass back the next k. > > > for( k = list; k; k = k_next ) > > > { > > > k_next = multiple_remove( k ); > > > } > > > Something in those lines might work. > > > > > > Htam > > > ----- Original Message ----- > > > From: "Jason Gauthier" <[EMAIL PROTECTED]> > > > To: <[email protected]> > > > Sent: 2003.10.21 06:42 > > > Subject: Removing linked lists items. > > > > > > > Greetings. > > > > > > > > Seems like a dumb question, but it's not what you would think. > > > > > > > > I am trying to remove items from a linked list. Normally, > > > > > > this is not > > > > > > > a problem for me. > > > > > > > > for (k=list; k!=NULL; k=k_next) { > > > > k_next = k->next; > > > > > > > > /* code code code */ > > > > } > > > > > > > > Is fine for removing one entry. However, I have a function > > > > > > that might > > > cause > > > > > > > several items in the list to be removed, including what > k_next is > > > > pointing at. This makes k_next start looping through > the k_free > > > > linked list. Definitely not what I want. > > > > > > > > Any suggestions? > > > > > > > > Jason > > > > > > > > -- > > > > ROM mailing list > > > > [email protected] http://www.rom.org/cgi-bin/mailman/listinfo/rom >

