BSD Ports

devel/tllist 1.1.0 DragonFly

C header file only implementation of a typed linked list

System
DragonFly
Repository
DPorts
Maintainer
[email protected] (as in FreeBSD)
License
MIT
Categories
devel
Package size
4.0 KiB, 14.3 KiB installed

Description

Most C implementations of linked list are untyped. That is, their data carriers are typically void *. This is error prone since your compiler will not be able to help you correct your mistakes (oh, was it a pointer-to-a-pointer... I thought it was just a pointer...).

tllist addresses this by using pre-processor macros to implement dynamic types, where the data carrier is typed to whatever you want; both primitive data types are supported as well as aggregated ones such as structs, enums and unions.

Being a double-linked list, most operations are constant in time (including pushing and popping both to/from front and back).

The memory overhead is fairly small; each item carries, besides its data, a prev and next pointer (i.e. a constant 16 byte overhead per item on 64-bit architectures).

The list itself has two head and tail pointers, plus a length variable (typically 8 bytes on 64-bit architectures) to make list length lookup constant in time.

Thus, assuming 64-bit pointers (and a 64-bit size_t type), the total overhead is 3*8 + n*2*8 bytes.

In the other systems

SystemPortVersion
DragonFlydevel/tllist1.1.0
FreeBSDdevel/tllist1.1.0
OpenBSDdevel/tllist1.1.0p0
NetBSDdevel/tllist1.1.0
MidnightBSDdevel/tllist1.1.0
HardenedBSDdevel/tllist1.1.0
GhostBSDdevel/tllist1.1.0

Install

Binary package:

pkg install tllist

From DPorts:

cd /usr/dports/devel/tllist && make install clean

Dependencies

No port depends on this one.