Skip to content

Commit

Permalink
c-list: merge branch 'th/c-list'
Browse files Browse the repository at this point in the history
  • Loading branch information
thom311 committed Nov 18, 2024
2 parents 9dbc16e + b54bab7 commit d4d1eb7
Show file tree
Hide file tree
Showing 15 changed files with 1,443 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ noinst_HEADERS = \
include/nl-priv-dynamic-core/object-api.h \
include/nl-priv-dynamic-route/nl-priv-dynamic-route.h \
include/nl-priv-static-route/nl-priv-static-route.h \
\
third_party/c-list/src/c-list.h \
\
$(NULL)

###############################################################################
Expand Down Expand Up @@ -395,6 +398,7 @@ default_includes = \
-I$(srcdir)/include/linux-private \
-I$(srcdir)/include \
-I$(builddir)/include \
-I$(srcdir)/third_party/c-list/src \
$(NULL)

default_cppflags = \
Expand Down
3 changes: 3 additions & 0 deletions include/netlink/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#ifndef NETLINK_LIST_H_
#define NETLINK_LIST_H_

/* For internal uses consider using "third_party/c-list/src/c-list.h" instead.
*/

#include <stddef.h>

#ifdef __cplusplus
Expand Down
2 changes: 2 additions & 0 deletions tests/check-direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <netlink/route/link.h>
#include <netlink/route/link/bridge.h>

#include "c-list.h"

#include "nl-priv-static-route/nl-priv-static-route.h"
#include "nl-aux-core/nl-core.h"

Expand Down
11 changes: 11 additions & 0 deletions third_party/c-list/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.{c,h}]
indent_style = space
indent_size = 8
32 changes: 32 additions & 0 deletions third_party/c-list/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Continuous Integration

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
ci-linux:
name: Linux CI
uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1
with:
cabuild_ref: "v1"
linux: true
m32: true
matrixmode: true
valgrind: true
ci-macos:
name: MacOS CI
uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1
with:
cabuild_ref: "v1"
linux: false
macos: true
ci-windows:
name: Windows CI
uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1
with:
cabuild_ref: "v1"
linux: false
windows: true
41 changes: 41 additions & 0 deletions third_party/c-list/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
LICENSE:
This project is dual-licensed under both the Apache License, Version
2.0, and the GNU Lesser General Public License, Version 2.1+.

AUTHORS-ASL:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

AUTHORS-LGPL:
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.

COPYRIGHT: (ordered alphabetically)
Copyright (C) 2015-2022 Red Hat, Inc.

AUTHORS: (ordered alphabetically)
Danilo Horta <[email protected]>
David Rheinsberg <[email protected]>
Lucas De Marchi <[email protected]>
Michele Dionisio
Thomas Haller <[email protected]>
Tom Gundersen <[email protected]>
77 changes: 77 additions & 0 deletions third_party/c-list/NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# c-list - Circular Intrusive Double Linked List Collection

## CHANGES WITH 3.1.0:

* The minimum required meson version is now 0.60.0.

* New function c_list_split() is added. It reverses c_list_splice()
and thus allows to split a list in half.

Contributions from: David Rheinsberg, Michele Dionisio

- Brno, 2022-06-22

## CHANGES WITH 3:

* API break: The c_list_loop_*() symbols were removed, since we saw
little use for them. No user was known at the time, so
all projects should build with the new API version
unchanged.
Since c-list does not distribute any compiled code, there
is no ABI issue with this change.

* Two new symbols c_list_length() and c_list_contains(). They are meant
for debugging purposes, to easily verify list integrity. Since they
run in O(n) time, they are not recommended for any other use than
debugging.

* New symbol c_list_init() is provided as alternative to the verbose
C_LIST_INIT assignment.

* The c-list API is extended to work well with `const CList` objects.
That is, any read-only accessor function allows constant objects as
input now.
Note that this does not propagate into other members linked in the
list. Using `const` for CList members is of little practical use.
However, it might be of use for its embedding objects, so we now
allow it in the CList API as well.

* The c_list_splice() call now clears the source list, rather than
returning with stale pointers. Technically, this is also an API
break, but unlikely to affect any existing code.

Contributions from: David Herrmann, Thomas Haller

- Berlin, 2017-08-13

## CHANGES WITH 2:

* Adjust project-name in build-system to reflect the actual project. The
previous releases incorrectly claimed to be c-rbtree in the build
system.

* Add c_list_swap() that swaps two lists given their head pointers.

* Add c_list_splice() that moves a list.

* Add LGPL2.1+ as license so c-list can be imported into GPL2 projects.
It is now officially dual-licensed.

* As usual a bunch of fixes, additional tests, and documentation
updates.

Contributions from: David Herrmann, Tom Gundersen

- Lund, 2017-05-03

## CHANGES WITH 1:

* Initial release of c-list.

* This project provides an implementation of a circular double linked
list in standard ISO-C11. License is ASL-2.0 and the build system
used is `Meson'.

Contributions from: David Herrmann, Tom Gundersen

- Berlin, 2017-03-03
52 changes: 52 additions & 0 deletions third_party/c-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
c-list
======

Circular Intrusive Double Linked List Collection

The c-list project implements an intrusive collection based on circular double
linked lists in ISO-C11. It aims for minimal API constraints, leaving maximum
control over the data-structures to the API consumer.

### Project

* **Website**: <https://c-util.github.io/c-list>
* **Bug Tracker**: <https://github.com/c-util/c-list/issues>

### Requirements

The requirements for this project are:

* `libc` (e.g., `glibc >= 2.16`)

At build-time, the following software is required:

* `meson >= 0.60`
* `pkg-config >= 0.29`

### Build

The meson build-system is used for this project. Contact upstream
documentation for detailed help. In most situations the following
commands are sufficient to build and install from source:

```sh
mkdir build
cd build
meson setup ..
ninja
meson test
ninja install
```

No custom configuration options are available.

### Repository:

- **web**: <https://github.com/c-util/c-list>
- **https**: `https://github.com/c-util/c-list.git`
- **ssh**: `[email protected]:c-util/c-list.git`

### License:

- **Apache-2.0** OR **LGPL-2.1-or-later**
- See AUTHORS file for details.
46 changes: 46 additions & 0 deletions third_party/c-list/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
project(
'c-list',
'c',
default_options: [
'c_std=c99',
],
license: 'Apache',
meson_version: '>=0.60.0',
version: '3.1.0',
)
major = meson.project_version().split('.')[0]
project_description = 'Circular Intrusive Double Linked List Collection'

mod_pkgconfig = import('pkgconfig')

# See c-stdaux for details on these. We do not have c-stdaux as dependency, so
# we keep a duplicated set here, reduced to the minimum.
cflags = meson.get_compiler('c').get_supported_arguments(
'-D_GNU_SOURCE',

'-Wno-gnu-alignof-expression',
'-Wno-maybe-uninitialized',
'-Wno-unknown-warning-option',
'-Wno-unused-parameter',

'-Wno-error=type-limits',
'-Wno-error=missing-field-initializers',

'-Wdate-time',
'-Wdeclaration-after-statement',
'-Wlogical-op',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wnested-externs',
'-Wredundant-decls',
'-Wshadow',
'-Wstrict-aliasing=3',
'-Wsuggest-attribute=noreturn',
'-Wundef',
'-Wwrite-strings',
)
add_project_arguments(cflags, language: 'c')

subdir('src')

meson.override_dependency('libclist-'+major, libclist_dep, static: true)
Loading

0 comments on commit d4d1eb7

Please sign in to comment.