On Thu, 2008-03-27 at 10:01 -0700, Kaustubh Patil wrote: > Hi, > > I am using glib (version 2.0) for developing some > applications. I have some questions about use of > Garray and GNode (G-n-ary tree). > > 1. Is it safe to return an initialized GArray * from a > function? e.g. copying garray array1 into garray > array2 and then returning pointer to array2. > > 2. For n-ary tree, is it possible to add strings > (static) as data? > > 3. Is it possible to add a structure as data in > n-ary-tree? If yes, how to the functions like > g_node_find work? > > Thanks in advance, > Kaustubh > > > > > ____________________________________________________________________________________ > Be a better friend, newshound, and > know-it-all with Yahoo! Mobile. Try it now. > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
1. Yes, just keep in mind to free any temporary data, and that garray2 will have to be freed by whatever needs the copy. 2. You can add anything as data (answers 3 also) data is just a pointer to the "actual data". to clarify.. no you cannot add an "int". but you can add a pointer to an int* or &int, string, GList, etc. 3. yes.. just add a pointer to your structure as ->data and typecast where needed. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list