This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Status of insque/remque


Ryan,

Thanks for the pointers.  I did a search of my toolchain and found GLib 2.0 with the GSList interface that you pointed out.  That was a surprise to me.  I'll look into using that, and if I have issues I'll fall back to the include/sys/queue.h implementation.

Thanks!
Bryan

-----Original Message-----
From: Ryan S. Arnold [mailto:ryan.arnold@gmail.com] 
Sent: Thursday, April 12, 2012 10:42 AM
To: Bryan Evenson
Cc: libc-help@sourceware.org
Subject: Re: Status of insque/remque

On Thu, Apr 12, 2012 at 7:59 AM, Bryan Evenson <bevenson@melinkcorp.com> wrote:
> I am writing a userspace application for an Angstrom Linux distribution (embedded Linux based on kernel 2.6.39) and I need some linked lists. ÂI don't need doubly linked list; simple singly linked list with insert, remove and forward searching are sufficient. ÂInstead of rolling my own, I'd prefer to use one that is already in existence.
>
> I am using glibc 2.12.2 and I see the insque/remque functions under search.h on my system. ÂBefore I start using insque/remque, I wanted to verify that there isn't a better linked list interface hiding somewhere in glibc or that there weren't plans to discontinue this interface in the near future. ÂIf I want a linked list, is this the interface to use?

The GLIBC provided versions of insque/remque are very simple.  They
handle insertion and removal.  Traversal/forward-searching is
something you'll have to do yourself (not terribly complicated).  I
don't see any indication in the POSIX specification that these
interfaces are going anywhere so I suspect their implementation in
GLIBC is quite concrete.

You could also checkout out include/sys/queue.h for some linked list
helper macros which actually DO provide searching.

A more robust list interface is provided by Glib in the GSList mechanism:

http://developer.gnome.org/glib/2.32/glib-Singly-Linked-Lists.html

I suspect that this may not be available in your embedded environment.

Ryan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]