Re: to GList or not to GList?
- From: "Tara M" <learfox furry ao net>
- To: "LIST: GTKAppDevel" <gtk-app-devel-list gnome org>
- Subject: Re: to GList or not to GList?
- Date: 31 Jul 2001 13:59:46 PDT
On Tue, 31 Jul 2001 19:22:00 +0530, Joshua N Pritikin said:
i've implement linked-lists about a million times, but i'm still confused.
The GList structure is stored separately from the data. What is the
rationale for this organization? Is it mainly for GINT_TO_POINTER & friends?
To contrast, here is a linked-list implementation that must be embedded in
the data object (see MIME attachment). For example,
struct mydata {
pe_ring peer;
pe_ring queue;
gint hits;
gint priority;
};
The GList is not for a specific data type, it's basically a
structure with two members, the member data is an opaque handle
that points to your actual data.
Since you have a structure called mydata, then you can
store it in a glist with
mydata *md = from_whatever;
glist->data = mydata;
So from then on glist->data will contain the (mydata *)pointer to
your structure.
--
--
Sincerely, ,"-_ \|/
-Capt. Taura M. , O=__ --X--
.__ ,_JNMNNEO=_ /|\
OMNOUMmnne. {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn. 'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe. "7OMMMMNNNNNWWEEEEOOOOOO" "'.
EEBNNMMMNWNWWEEIMMNe. __ 7EMMMNNNNNWWWEEEEEEEOO. " .
NNMMMMWWWMMMWEINMMMNn "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._ .
http://furry.ao.net/~learfox/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]