Re: [gtk-list] some things...



Hi.
ziobudda wrote:
> 
> Hi, I'm making a new gtk-mail program with pop3 functionality. Now I must
> to implement the GList foreach single mail. Ok for this, but which are the
> differences between GList and GSList? Ok, i have read the GList are the
> Linked List and GSList are the Signle (?) List, but I see (in the gtk
> manual) that the 2 gtk-items have the same function. Which are ,so, the
> difference? Now i'm reading the glib.h file and see that the difference
> (logic!!!) are :
> 
> struct _GList
> {
>   gpointer data;
>   GList *next;
>   GList *prev;     <---- this is the difference
> };
> 
> struct _GSList
> {
>   gpointer data;
>   GSList *next;
> };
> 
> In the Linked list can someone add an pointer to the aim current item?
> And the linked function g_list_next and g_list_prev ?
> Are these function not usefull?
	As you say the only diference is the "prev" pointer. GSList is a single
linked list and GList is a double linked list. Both are clasical data
structures. With double linked lists you can go fordward or backward at
the cost of a extra pointer in each item.
	To manipulate each structure you use diferent function. To work with
GList you use:
	g_list_*

	And to work with GSList:

	g_slist_*

	As GSList has no previus pointer, macro g_slist_prev doesn't exist.
> 
> And now String items...
> I have write sone new function, and these are the single code :
> char *
> g_string_return(GString *string)
> { return string->str;
> }
> 
> int
> g_string_length(GString *string)
> { return string->len;
> }
> 
> int
> g_strncmp(gchar *s1, gchar *s2, int n)
> {
>   return (strncmp(s1,s2,n));
> }
> 
> int g_string_ncmp(GString *s1, GString *s2, int n)
> { return g_strncmp(s1->str, s2->str,n);
> }
> 
> I think that an interface between the implementation and what the coder
> want to see (and learn) is better that none.
> 
> ciaoz
> --
> Morelli 'ZioBudda' Davide Michel - Member of Pluto Linux User Group
> ziobudda@chiara.dei.unipd.it - http://www.dau.ing.univaq.it/~ziobudda/
> Linux Problem? Ask to linux@media.dsi.unimi.it
> "/dev/ziobudda: access to /var/tmp/beer denied, use /var/adm/pineapple"
> 
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

-- 
+--------------------------+---------------------------+
|David Abilleira Freijeiro | Pontevedra, España        |
+--------------------------+---------------------------+
|http://members.xoom.com/odaf   (mailto:odaf@nexo.es)  |
|    (UNED, Mis Programas, Linux, Programación, etc.)  |
|WAINU: http://www.geocities.com/Athens/Forum/5889/    |
+------------------------------------------------------+



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