Re: GLib: embedded list implementation?
- From: Matthew Barnes <mbarnes redhat com>
- To: gtk-devel-list gnome org
- Subject: Re: GLib: embedded list implementation?
- Date: Fri, 30 Nov 2007 14:09:11 -0500
On Fri, 2007-11-30 at 10:41 -0500, Behdad Esfahbod wrote:
> > The Linux kernel has a unique, and useful, doubly-linked list
> > implementation that I find myself constantly copying into the userspace
> > programs that I write. As a frequent user of GLib in my console-based
> > and server applications, I thought it would be nice to have included in
> > GLib proper, and wanted to solicit the opinions of current developers.
>
> When I first came around GLib I wanted to propose the same... Basically
> the current GLib lists and the kernel-style lists are two different
> things. They have completely different uses and purposes.
This might be crack but it's crossed my mind before.
What about embedding a GList node at the top of a larger struct, as we
do with GObjects? e.g.
struct MyNode {
GList parent;
... other data ...
};
Sure you'd have an unused 'data' pointer in every node, but it might be
possible to use a subset of the GList and GQueue APIs that only
manipulate GList pointers (not the 'data' pointer) and avoid the need
for a bunch of list macros.
I'm sure GList was not designed with this in mind so I have no idea if
the API is safe to use this way. I've never been crazy enough to try.
Matthew Barnes
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]