Date: Thu, 21 May 2020 21:46:56 +0000 (UTC) From: Lorenzo Salvadore <salvadore@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r536174 - in head/devel: . tllist Message-ID: <202005212146.04LLkuZ6004344@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: salvadore Date: Thu May 21 21:46:56 2020 New Revision: 536174 URL: https://svnweb.freebsd.org/changeset/ports/536174 Log: 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 a head and a tail pointer, 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. WWW: https://codeberg.org/dnkl/tllist PR: 245410 Submitted by: ports@xanderio.de Added: head/devel/tllist/ head/devel/tllist/Makefile (contents, props changed) head/devel/tllist/distinfo (contents, props changed) head/devel/tllist/pkg-descr (contents, props changed) Modified: head/devel/Makefile Modified: head/devel/Makefile ============================================================================== --- head/devel/Makefile Thu May 21 21:31:01 2020 (r536173) +++ head/devel/Makefile Thu May 21 21:46:56 2020 (r536174) @@ -6721,6 +6721,7 @@ SUBDIR += tkp4 SUBDIR += tl-expected SUBDIR += tla + SUBDIR += tllist SUBDIR += tmake SUBDIR += tnt SUBDIR += tokamak Added: head/devel/tllist/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/tllist/Makefile Thu May 21 21:46:56 2020 (r536174) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +PORTNAME= tllist +DISTVERSION= 1.0.0 +CATEGORIES= devel +MASTER_SITES= https://codeberg.org/dnkl/tllist/archive/ +DISTNAME= ${DISTVERSION} + +MAINTAINER= ports@xanderio.de +COMMENT= C header file only implementation of a typed linked list + +LICENSE= MIT + +USES= meson + +WRKSRC= ${WRKDIR}/${PORTNAME} + +PLIST_FILES= include/tllist.h \ + libdata/pkgconfig/tllist.pc + +.include <bsd.port.mk> Added: head/devel/tllist/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/tllist/distinfo Thu May 21 21:46:56 2020 (r536174) @@ -0,0 +1,3 @@ +TIMESTAMP = 1586201195 +SHA256 (1.0.0.tar.gz) = 115f067f6b7029959fea39e45ec64697806e901fe4ca2de67c7eb2af4b7d2ae2 +SIZE (1.0.0.tar.gz) = 6677 Added: head/devel/tllist/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/tllist/pkg-descr Thu May 21 21:46:56 2020 (r536174) @@ -0,0 +1,24 @@ +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 a head and a tail pointer, 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. + +WWW: https://codeberg.org/dnkl/tllist
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005212146.04LLkuZ6004344>