concurrent GList

2014-03-27 Thread Joël Krähemann
Hi, is there a concurrent GList around? It should use of atomic operations. My project probably has need for it. Due to concurrency problems. I believe I get those errors cause of unfinished operations. Since I'm working on performance. Please visit my project: http://sf.net/p/ags regards Joël

Re: GList strange behavior

2012-08-16 Thread Tadej Borovšak
Hi. Not sure what is troubling you here. GList is represented by pointer to first element or NULL if list is empty. And when you append items to the list, the address of the list stays the same, since first element of the list is unchanged (exception to this is when append first element

Re: GList strange behavior

2012-08-16 Thread Vlasov Vitaly
Thank you! I almost understand bahavior of GList. I need to save newly created list poiner. So, i need to use g_list_last() to save it? Is there another method to save created list pointer? В сообщении от Четверг 16 августа 2012 15:51:22 вы написали: Hi. Not sure what is troubling you here

Re: GList strange behavior

2012-08-16 Thread David Nečas
On Thu, Aug 16, 2012 at 06:49:25PM +0400, Vlasov Vitaly wrote: I need to save newly created list poiner. No. Many operations change the list head (by adding, removing, reordering, ..., elements). In general, if an operation returns the new list head you *must* save and use that in subsequent

Re: GList strange behavior

2012-08-16 Thread Ardhan Madras
list for you, save the address to the return pointer. If you pass non NULL pointer (already created list) to first arg of g_list_append() it will ALWAYS return the HEAD of the list and will not create a new list. It's better for you to read GList implementation source code. (glist.c) to fully

Re: GList strange behavior

2012-08-15 Thread Vlasov Vitaly
Hello Thanks for answer. Did you mean Last list element: 0x832c610 is differ from INIT list prt: 0x830f080? No. Lest's see... i got function do_work with: 1. new Glist init with random data 2. callback definition of button click: button_click(, GList *list) let

GList strange behavior

2012-08-14 Thread Vlasov Vitaly
Hi, list. I can't understand, why g_list_append return different values in my callback's(please read source). In first case i got same list, which was obtained from arguments. In second case g_list_append returns newly created list. Why result's is are not the same? In real program, i

Re: GList strange behavior

2012-08-14 Thread Ardhan Madras
of the list (address). in test_glist() First you call temp = g_list_insert(test, ...), test = NULL, save the list to temp pointer to GList, second, you call temp = g_list_append(test, ...), nothing wrong with that code! BUT if you suppose to insert 2nd list here, then you are wrong. Because, test is STILL

Re: GList empty after iteration?

2011-09-21 Thread Olivier Sessink
On 09/12/2011 11:33 PM, Craig wrote: On Mon, 2011-09-12 at 22:20 +0200, Florian Müllner wrote: You are modifying the list in the loop until g_list_next() returns NULL ... Right. I understand this now. However, I thought using g_list_first() would set GList *events back to the first

Re: GList empty after iteration?

2011-09-13 Thread David King
On 2011-09-12 15:10, Craig craigbakal...@verizon.net wrote: Hi All, I am confused about GList. My application is parsing a file and creating midi data with it. I am using GList to store the midi data. I have created a GtkListStore to view the parsed data (to insure I am parsing the data

Re: GList empty after iteration?

2011-09-12 Thread Denis Washington
Am 12.09.2011 21:10, schrieb Craig: Hi All, I am confused about GList. My application is parsing a file and creating midi data with it. I am using GList to store the midi data. I have created a GtkListStore to view the parsed data (to insure I am parsing the data properly). So, below I

Re: GList empty after iteration?

2011-09-12 Thread Florian Müllner
On lun, 2011-09-12 at 15:10 -0400, Craig wrote: I am shocked to see that after I iterate through the GList, I cannot iterate through the list again. That's an easy one :-) while(events) { /* [...] */ events = g_list_next(events

Re: GList empty after iteration?

2011-09-12 Thread Bernhard Schuster
2011/9/12 Craig craigbakal...@verizon.net: Hi All, I am confused about GList. My application is parsing a file and creating midi data with it. I am using GList to store the midi data.  I have created a GtkListStore to view the parsed data (to insure I am parsing the data properly).  So

Re: GList empty after iteration?

2011-09-12 Thread Colomban Wendling
Le 12/09/2011 21:10, Craig a écrit : Hi All, I am confused about GList. My application is parsing a file and creating midi data with it. I am using GList to store the midi data. I have created a GtkListStore to view the parsed data (to insure I am parsing the data properly). So, below I

Re: GList empty after iteration?

2011-09-12 Thread Andrey Maklakov
Hello Craig, I think this is because after first loop, variable events is NULL, and you cant get first element of GList from it: g_list_next() --- Returns : the next element, or NULL if there are no more elements. Hi All, I am confused about GList. My application is parsing a file

Re: Global GList in gtk+ application

2010-06-19 Thread Ardhan Madras
Then how global variable `Data' was declared in your code? --- kuleshovm...@gmail.com wrote: From: Alexander Kuleshov kuleshovm...@gmail.com To: gtk-app-devel-list@gnome.org Subject: Global GList in gtk+ application Date: Sat, 12 Jun 2010 12:03:40 +0600 Hello, I need in global list in my gtk

Global GList in gtk+ application

2010-06-12 Thread Alexander Kuleshov
Hello, I need in global list in my gtk+ application, i use for it GList: For example: I have structure: typedef struct _data { Glist list; }Data; I want to use one copy of the list in the whole program: I have a function bulid my list: gboolean build_list() { Data-list = g_list_append

Re: Global GList in gtk+ application

2010-06-12 Thread Tor Lillqvist
If you want to show code, at least show something that compiles and exhibits your problem (if any), i.e. a minimal but complete sample. Anyway, I don't see what your problem has to do with GTK+. --tml ___ gtk-app-devel-list mailing list

Re: Global GList in gtk+ application

2010-06-12 Thread Colomban Wendling
Le 12/06/2010 08:03, Alexander Kuleshov a écrit : [snip] I have a function bulid my list: gboolean build_list() { Data-list = g_list_append(Data-list, First ); Data-list = g_list_append(Data-list, Second ); Data-list = g_list_append(Data-list, Third );

How to use GList Double Link List

2007-12-25 Thread sumit kumar
Hi All, I am trying to use GLib double link list in my application.But I have a problem. I run the GList sample program from Gtk+-2.0 FAQ:- *GList *list = NULL; GList *listrunner; gint array[] = { 1, 2, 3, 4, 5, 6 }; gint pos; gint *value; /* add data to the list */ for (pos=0;pos 6; pos

Re: How to use GList Double Link List

2007-12-25 Thread Jim George
On Dec 25, 2007 9:50 PM, sumit kumar [EMAIL PROTECTED] wrote: Hi All, I am trying to use GLib double link list in my application.But I have a problem. I run the GList sample program from Gtk+-2.0 FAQ:- *snip* *gint pos; g_print(Enter Number1\n); scanf(%d,pos); list = g_list_append(list

Re: How to use GList Double Link List

2007-12-25 Thread Matí­as Alejandro Torres
) { GList *tmp, *list = NULL; gint i, *element; /* Appends 4 integers into list */ for (i=1; i5; i++) { element = g_malloc (sizeof (gint)); g_printf (Enter Number %d: , i); scanf (%d, element); list

Re: How do you get the data from a GList?

2006-11-17 Thread Matías Torres
/GtkTreeModel.html#gtk-tree-row-reference-new Single Linked Listhttp://developer.gnome.org/doc/API/2.0/glib/glib-Singly-Linked-Lists.html(g_slist_nth_data , g_slist_foreach) 2006/11/17, Steven Boyls [EMAIL PROTECTED]: I have created a GList with the following code : GList *my_list

Re: How do you get the data from a GList?

2006-11-17 Thread Matias Torres
Ouch! change this next = g_slist_next (node); to node = g_slist_next (node); ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: How do you get the data from a GList?

2006-11-17 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Fri, Nov 17, 2006 at 09:44:01AM -0600, Steven Boyls wrote: I have created a GList with the following code : GList *my_list; GtkTreeSelection *selection; GtkTreeModel *model; selection

how to free GList

2006-09-12 Thread shibu Alampatta
Hi all, Pls see the below code structure. how to free the glist at the indicated place? GList * glist=NULL; for(i=0;in;i++) g_list_append(glist,a[i]); // some processing //here want to free the glist Thks in advance.. Shibu ___ gtk

Re: how to free GList

2006-09-12 Thread Vivien Malerba
On 9/12/06, shibu Alampatta [EMAIL PROTECTED] wrote: Hi all, Pls see the below code structure. how to free the glist at the indicated place? GList * glist=NULL; for(i=0;in;i++) g_list_append(glist,a[i]); // some processing //here want to free the glist g_list_free

Re: how to free GList

2006-09-12 Thread Yash Kumar Gupta
see the below code structure. how to free the glist at the indicated place? GList * glist=NULL; for(i=0;in;i++) g_list_append(glist,a[i]); // some processing //here want to free the glist Thks in advance.. Shibu ___ gtk-app

How to detect if a glist-data is a GUINT_TO_POINTER for not freeing it ?

2006-04-21 Thread Colossus
Hi, I have to fill a GList with strings and unsigned long int. The content of the GList is not always the same so I don't know wich element is a string to free or a GUINT_TO_POINTER that I don't have to free. Is there a trick to do so ? Thanks, -- Colossus Xarchiver, a Linux GTK+2 only archive

Re: How to detect if a glist-data is a GUINT_TO_POINTER for not freeing it ?

2006-04-21 Thread Enrico Tröger
On Fri, 21 Apr 2006 12:11:48 +0200, Colossus [EMAIL PROTECTED] wrote: Hi Colossus, I have to fill a GList with strings and unsigned long int. The content of the GList is not always the same so I don't know wich element is a string to free or a GUINT_TO_POINTER don't use GUINT_TO_POINTER

Re: How to detect if a glist-data is a GUINT_TO_POINTER for not freeing it ?

2006-04-21 Thread Colossus
Enrico Tröger wrote: give it some value *iptr = 100l; Hi Enrico, thanks for replying. Which value is the above ? Hexadecimal one ?? Or what else ? -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.xfce.org Cpsed, a Linux OpenGL 3D scene editor -

Re: How to detect if a glist-data is a GUINT_TO_POINTER for not freeing it ?

2006-04-21 Thread Enrico Tröger
On Fri, 21 Apr 2006 12:44:48 +0200, Colossus [EMAIL PROTECTED] wrote: Enrico Tröger wrote: give it some value *iptr = 100l; thanks for replying. Which value is the above ? Hexadecimal one ?? Or what else ? No, it is a simple decimal value. I appended the l to emphasise that it is a

Re: How to detect if a glist-data is a GUINT_TO_POINTER for not freeing it ?

2006-04-21 Thread Colossus
long long int)); *_original = atoll (original); g_free (original); later I fill the GList: archive-row = g_list_prepend (archive-row , _original) ; Then in another file.c I have to fill the liststore by retrieving the values from the GList: gtk_list_store_set(GTK_LIST_STORE(list_store), iter, i

Re: How to detect if a glist-data is a GUINT_TO_POINTER for not freeing it ?

2006-04-21 Thread Christian Neumair
of mallocs, just one pointer more to pass around. GList *nbr; GList *str; nbr = str = NULL; for (i = 0; mydatasource[i] != NULL; i++) { nbr = g_list_prepend (nbr, GUINT_TO_POINTER (mydatasource[i].myint)); str = g_list_prepend (str, g_strdup (mydatasource[i].mystr)); } nbr = g_list_reverse (nbr); str

Re: How to detect if a glist-data is a GUINT_TO_POINTER for not freeing it ?

2006-04-21 Thread Enrico Tröger
, end - start); unsigned long long int *_original = g_malloc(sizeof(unsigned long long int)); *_original = atoll (original); g_free (original); later I fill the GList: archive-row = g_list_prepend (archive-row , _original) ; Then in another file.c I have to fill the liststore by retrieving

Re: How to detect if a glist-data is a GUINT_TO_POINTER for not freeing it ?

2006-04-21 Thread Colossus
Hi, Thank you all for your kind answers. -- Colossus Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.xfce.org Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net

Re: GList

2005-08-18 Thread HuamiSoft Hubert Sokolowski
Hi! On Thu, 18 Aug 2005 00:52:45 -0500 Tristan Sloughter [EMAIL PROTECTED] wrote: I am using GLists and want to make sure I am freeing all the memory, and not twice or course. There are three possible functions for removing an element from the list: g_list_remove (GList *list

Re: GList

2005-08-18 Thread David Necas (Yeti)
On Thu, Aug 18, 2005 at 12:52:45AM -0500, Tristan Sloughter wrote: I am using GLists and want to make sure I am freeing all the memory, and not twice or course. There are three possible functions for removing an element from the list: g_list_remove (GList *list, gconstpointer data

Re: GList

2005-08-18 Thread HuamiSoft Hubert Sokolowski
for removing an element from the list: g_list_remove (GList *list, gconstpointer data); g_list_remove_link (GList *list, GList *llink); g_list_delete_link (GList *list, GList *link_); And while their names are confusing a bit, because the only difference between g_list_remove() and g_list_delete

Re: GList

2005-08-18 Thread Chris Vine
On Thursday 18 August 2005 08:51, HuamiSoft Hubert Sokolowski wrote: always when you allocate a memory, you need to free it by your self. to free a list completely you need to free /data/ by your self if it points to some memory that you allocated. g_list_remove removes an element from a list

Re: GList

2005-08-18 Thread HuamiSoft Hubert Sokolowski
On Thu, 18 Aug 2005 20:17:34 +0100 Chris Vine [EMAIL PROTECTED] wrote: On Thursday 18 August 2005 08:51, HuamiSoft Hubert Sokolowski wrote: always when you allocate a memory, you need to free it by your self. to free a list completely you need to free /data/ by your self if it points to

GList

2005-08-17 Thread Tristan Sloughter
I am using GLists and want to make sure I am freeing all the memory, and not twice or course. There are three possible functions for removing an element from the list: g_list_remove (GList *list, gconstpointer data); g_list_remove_link (GList *list, GList *llink); g_list_delete_link (GList

Re: GList

2005-05-03 Thread Vivien Malerba
On 5/2/05,[EMAIL PROTECTED] wrote: i think that the result of next code must be 3. but i have 0 if uncomment l=... it's work correctly #include glib.h int main() { GList* l=NULL; //l=g_list_alloc(); g_list_append(l,GINT_TO_POINTER(1)); g_list_append(l

Re: GList

2005-05-03 Thread Tim Müller
On Monday 02 May 2005 18:13, wrote: I think that the result of next code must be 3, but I have 0. If uncomment l=... it's work correctly GList* l=NULL; //l=g_list_alloc(); g_list_append(l,GINT_TO_POINTER(1)); g_list_append(l,GINT_TO_POINTER(1)); g_list_append(l

Re: GList

2005-05-03 Thread Paul Pogonyshev
wrote: i think that the result of next code must be 3. but i have 0 if uncomment l=... it's work correctly #include glib.h int main() { GList* l=NULL; //l=g_list_alloc(); g_list_append(l,GINT_TO_POINTER(1)); g_list_append(l,GINT_TO_POINTER(1)); g_list_append(l