[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
RE: double linked glists
- From: Havoc Pennington <rhp zirx pair com>
- To: "'gtk-app-devel-list redhat com'" <gtk-app-devel-list redhat com>
- Subject: RE: double linked glists
- Date: Mon, 7 Jun 1999 17:26:59 -0400 (EDT)
On Mon, 7 Jun 1999, BIRCH, JANET M wrote:
>
> GList *Key_SSN_List; <-- a global
>
> void goto_next_record(GtkNotebook *data)
> {
> gint page = -1;
>
> page = gtk_notebook_get_current_page(GTK_NOTEBOOK(data)):
> if (page == SSN_BARRED_PG)
> {
> Key_SSN_List = g_list_next(Key_SSN_List);
> if (Key_SSN_List == NULL)
> printf("No more records in that direction\n");
OK, NULL isn't the last link, it's one past the last link -it's the empty
list. There's no way glib can get from NULL to a pointer to the previous
list item.
If you want to go back, you need to avoid setting Key_SSN_List to NULL -
stop at the last item, that is, when Key_SSN_List->next == NULL.
Havoc
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]