bug in glib?



Hello,

I've noticed that the g_slist_length function looks like this:

guint
g_slist_length (GSList *list)
{
  guint length;

  length = 0;
  while (list)
    {
      length++;
      list = list->next;
    }

  return length;
}

doesn't this mean that the list pointer gets "destroyed" when using the
function, something that can lead to bugs if you don't know the behavior
(the docs don't say anything).

The fix would of course be to add a dummy variable when going through
the list.

//andersca
andersca@gnu.org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]