Skip to content

Commit d4d1eb7

Browse files
committed
c-list: merge branch 'th/c-list'
#412
2 parents 9dbc16e + b54bab7 commit d4d1eb7

File tree

15 files changed

+1443
-0
lines changed

15 files changed

+1443
-0
lines changed

Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ noinst_HEADERS = \
338338
include/nl-priv-dynamic-core/object-api.h \
339339
include/nl-priv-dynamic-route/nl-priv-dynamic-route.h \
340340
include/nl-priv-static-route/nl-priv-static-route.h \
341+
\
342+
third_party/c-list/src/c-list.h \
343+
\
341344
$(NULL)
342345

343346
###############################################################################
@@ -395,6 +398,7 @@ default_includes = \
395398
-I$(srcdir)/include/linux-private \
396399
-I$(srcdir)/include \
397400
-I$(builddir)/include \
401+
-I$(srcdir)/third_party/c-list/src \
398402
$(NULL)
399403

400404
default_cppflags = \

include/netlink/list.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#ifndef NETLINK_LIST_H_
77
#define NETLINK_LIST_H_
88

9+
/* For internal uses consider using "third_party/c-list/src/c-list.h" instead.
10+
*/
11+
912
#include <stddef.h>
1013

1114
#ifdef __cplusplus

tests/check-direct.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <netlink/route/link.h>
1111
#include <netlink/route/link/bridge.h>
1212

13+
#include "c-list.h"
14+
1315
#include "nl-priv-static-route/nl-priv-static-route.h"
1416
#include "nl-aux-core/nl-core.h"
1517

third_party/c-list/.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
9+
[*.{c,h}]
10+
indent_style = space
11+
indent_size = 8
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
jobs:
10+
ci-linux:
11+
name: Linux CI
12+
uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1
13+
with:
14+
cabuild_ref: "v1"
15+
linux: true
16+
m32: true
17+
matrixmode: true
18+
valgrind: true
19+
ci-macos:
20+
name: MacOS CI
21+
uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1
22+
with:
23+
cabuild_ref: "v1"
24+
linux: false
25+
macos: true
26+
ci-windows:
27+
name: Windows CI
28+
uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1
29+
with:
30+
cabuild_ref: "v1"
31+
linux: false
32+
windows: true

third_party/c-list/AUTHORS

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
LICENSE:
2+
This project is dual-licensed under both the Apache License, Version
3+
2.0, and the GNU Lesser General Public License, Version 2.1+.
4+
5+
AUTHORS-ASL:
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
AUTHORS-LGPL:
19+
This program is free software; you can redistribute it and/or modify it
20+
under the terms of the GNU Lesser General Public License as published
21+
by the Free Software Foundation; either version 2.1 of the License, or
22+
(at your option) any later version.
23+
24+
This program is distributed in the hope that it will be useful, but
25+
WITHOUT ANY WARRANTY; without even the implied warranty of
26+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27+
Lesser General Public License for more details.
28+
29+
You should have received a copy of the GNU Lesser General Public License
30+
along with this program; If not, see <http://www.gnu.org/licenses/>.
31+
32+
COPYRIGHT: (ordered alphabetically)
33+
Copyright (C) 2015-2022 Red Hat, Inc.
34+
35+
AUTHORS: (ordered alphabetically)
36+
Danilo Horta <[email protected]>
37+
David Rheinsberg <[email protected]>
38+
Lucas De Marchi <[email protected]>
39+
Michele Dionisio
40+
Thomas Haller <[email protected]>
41+
Tom Gundersen <[email protected]>

third_party/c-list/NEWS.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# c-list - Circular Intrusive Double Linked List Collection
2+
3+
## CHANGES WITH 3.1.0:
4+
5+
* The minimum required meson version is now 0.60.0.
6+
7+
* New function c_list_split() is added. It reverses c_list_splice()
8+
and thus allows to split a list in half.
9+
10+
Contributions from: David Rheinsberg, Michele Dionisio
11+
12+
- Brno, 2022-06-22
13+
14+
## CHANGES WITH 3:
15+
16+
* API break: The c_list_loop_*() symbols were removed, since we saw
17+
little use for them. No user was known at the time, so
18+
all projects should build with the new API version
19+
unchanged.
20+
Since c-list does not distribute any compiled code, there
21+
is no ABI issue with this change.
22+
23+
* Two new symbols c_list_length() and c_list_contains(). They are meant
24+
for debugging purposes, to easily verify list integrity. Since they
25+
run in O(n) time, they are not recommended for any other use than
26+
debugging.
27+
28+
* New symbol c_list_init() is provided as alternative to the verbose
29+
C_LIST_INIT assignment.
30+
31+
* The c-list API is extended to work well with `const CList` objects.
32+
That is, any read-only accessor function allows constant objects as
33+
input now.
34+
Note that this does not propagate into other members linked in the
35+
list. Using `const` for CList members is of little practical use.
36+
However, it might be of use for its embedding objects, so we now
37+
allow it in the CList API as well.
38+
39+
* The c_list_splice() call now clears the source list, rather than
40+
returning with stale pointers. Technically, this is also an API
41+
break, but unlikely to affect any existing code.
42+
43+
Contributions from: David Herrmann, Thomas Haller
44+
45+
- Berlin, 2017-08-13
46+
47+
## CHANGES WITH 2:
48+
49+
* Adjust project-name in build-system to reflect the actual project. The
50+
previous releases incorrectly claimed to be c-rbtree in the build
51+
system.
52+
53+
* Add c_list_swap() that swaps two lists given their head pointers.
54+
55+
* Add c_list_splice() that moves a list.
56+
57+
* Add LGPL2.1+ as license so c-list can be imported into GPL2 projects.
58+
It is now officially dual-licensed.
59+
60+
* As usual a bunch of fixes, additional tests, and documentation
61+
updates.
62+
63+
Contributions from: David Herrmann, Tom Gundersen
64+
65+
- Lund, 2017-05-03
66+
67+
## CHANGES WITH 1:
68+
69+
* Initial release of c-list.
70+
71+
* This project provides an implementation of a circular double linked
72+
list in standard ISO-C11. License is ASL-2.0 and the build system
73+
used is `Meson'.
74+
75+
Contributions from: David Herrmann, Tom Gundersen
76+
77+
- Berlin, 2017-03-03

third_party/c-list/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
c-list
2+
======
3+
4+
Circular Intrusive Double Linked List Collection
5+
6+
The c-list project implements an intrusive collection based on circular double
7+
linked lists in ISO-C11. It aims for minimal API constraints, leaving maximum
8+
control over the data-structures to the API consumer.
9+
10+
### Project
11+
12+
* **Website**: <https://c-util.github.io/c-list>
13+
* **Bug Tracker**: <https://github.com/c-util/c-list/issues>
14+
15+
### Requirements
16+
17+
The requirements for this project are:
18+
19+
* `libc` (e.g., `glibc >= 2.16`)
20+
21+
At build-time, the following software is required:
22+
23+
* `meson >= 0.60`
24+
* `pkg-config >= 0.29`
25+
26+
### Build
27+
28+
The meson build-system is used for this project. Contact upstream
29+
documentation for detailed help. In most situations the following
30+
commands are sufficient to build and install from source:
31+
32+
```sh
33+
mkdir build
34+
cd build
35+
meson setup ..
36+
ninja
37+
meson test
38+
ninja install
39+
```
40+
41+
No custom configuration options are available.
42+
43+
### Repository:
44+
45+
- **web**: <https://github.com/c-util/c-list>
46+
- **https**: `https://github.com/c-util/c-list.git`
47+
- **ssh**: `[email protected]:c-util/c-list.git`
48+
49+
### License:
50+
51+
- **Apache-2.0** OR **LGPL-2.1-or-later**
52+
- See AUTHORS file for details.

third_party/c-list/meson.build

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
project(
2+
'c-list',
3+
'c',
4+
default_options: [
5+
'c_std=c99',
6+
],
7+
license: 'Apache',
8+
meson_version: '>=0.60.0',
9+
version: '3.1.0',
10+
)
11+
major = meson.project_version().split('.')[0]
12+
project_description = 'Circular Intrusive Double Linked List Collection'
13+
14+
mod_pkgconfig = import('pkgconfig')
15+
16+
# See c-stdaux for details on these. We do not have c-stdaux as dependency, so
17+
# we keep a duplicated set here, reduced to the minimum.
18+
cflags = meson.get_compiler('c').get_supported_arguments(
19+
'-D_GNU_SOURCE',
20+
21+
'-Wno-gnu-alignof-expression',
22+
'-Wno-maybe-uninitialized',
23+
'-Wno-unknown-warning-option',
24+
'-Wno-unused-parameter',
25+
26+
'-Wno-error=type-limits',
27+
'-Wno-error=missing-field-initializers',
28+
29+
'-Wdate-time',
30+
'-Wdeclaration-after-statement',
31+
'-Wlogical-op',
32+
'-Wmissing-include-dirs',
33+
'-Wmissing-noreturn',
34+
'-Wnested-externs',
35+
'-Wredundant-decls',
36+
'-Wshadow',
37+
'-Wstrict-aliasing=3',
38+
'-Wsuggest-attribute=noreturn',
39+
'-Wundef',
40+
'-Wwrite-strings',
41+
)
42+
add_project_arguments(cflags, language: 'c')
43+
44+
subdir('src')
45+
46+
meson.override_dependency('libclist-'+major, libclist_dep, static: true)

0 commit comments

Comments
 (0)