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

RE: double linked glists



worked like a charm !!!!   I was sure it had to be something stupid simple.

-----Original Message-----
From: Havoc Pennington [mailto:rhp@zirx.pair.com]
Sent: Monday, June 07, 1999 4:27 PM
To: 'gtk-app-devel-list@redhat.com'
Subject: RE: double linked glists



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



-- 
         To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
                       "unsubscribe" as the Subject.

	Mailing list concerns should be mailed to <listmaster@redhat.com>



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