llist_pop error

Vladimir N. Oleynik dzo at simtreas.ru
Thu May 11 16:34:25 UTC 2006


#ifdef L_llist_pop
/* Remove first element from the list and return it */
void *llist_pop(llist_t **head)
{
	void *data;

	if(!*head) data = *head;
	else {
		void *next = (*head)->link;
		data = (*head)->data;
-		*head = (*head)->link;
-		free(next);
+		free(*head);
+		*head = next;
	}

	return data;
}
#endif

And why not added landley (c) line? ;-)


--w
vodz




More information about the busybox mailing list