Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 22 additions & 33 deletions lib/cfl/.github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-2019]
os: [windows-latest, windows-2022]
steps:
- uses: actions/checkout@v4
- name: Build on ${{ matrix.os }} with vs-2019
- uses: actions/checkout@v6
- name: Build on ${{ matrix.os }} with MSVC
run: |
.\scripts\win_build.bat
- name: Run unit tests.
Expand All @@ -31,9 +31,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-2019]
os: [windows-latest, windows-2022]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Get dependencies w/ chocolatey
uses: crazy-max/ghaction-chocolatey@v3
with:
Expand Down Expand Up @@ -106,7 +106,11 @@ jobs:
steps:
- name: Set up base image dependencies
run: |
apt-get update
printf '%s\n' \
'deb http://archive.debian.org/debian buster main' \
'deb http://archive.debian.org/debian-security buster/updates main' \
> /etc/apt/sources.list
apt-get -o Acquire::Check-Valid-Until=false update
apt-get install -y build-essential wget make gcc g++

- name: Install CMake 3.20.0
Expand All @@ -122,7 +126,7 @@ jobs:
# Confirm CMake installation
/usr/local/bin/cmake --version

- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Run compilation
run: |
Expand All @@ -138,7 +142,7 @@ jobs:
os: [ubuntu-latest]
compiler: [ gcc, clang ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build on ${{ matrix.os }} with ${{ matrix.compiler }}
uses: uraimo/run-on-arch-action@v3.0.1
with:
Expand Down Expand Up @@ -167,7 +171,7 @@ jobs:
os: [ubuntu-latest, macos-latest]
compiler: [ gcc, clang ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build on ${{ matrix.os }} with ${{ matrix.compiler }}
run: |
echo "CC = $CC, CXX = $CXX"
Expand All @@ -193,36 +197,21 @@ jobs:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true
dependencies_debian: 'wget'

- name: Install CMake 3.20.0
run: |
CMAKE_VERSION=3.20.0
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh
chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh

# Create a writable temporary directory
mkdir -p /tmp/cmake

# Install CMake to /tmp/cmake
./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/tmp/cmake

# Add CMake to the PATH
echo 'export PATH=/tmp/cmake/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

# Verify installation
/tmp/cmake/bin/cmake --version

- uses: actions/checkout@v4
- uses: docker://lpenz/ghaction-cmake:0.19
with:
pre_command: |
CMAKE_VERSION=3.20.0
curl -fsSLO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh
chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh
./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local
cmake --version
preset: ${{ matrix.preset }}

cmakeflags: '-DCFL_TESTS=On -DCFL_DEV=on .'
build_command: /tmp/cmake/bin/cmake && make all
build_command: make all

# this job provides the single required status for PRs to be merged into main.
# instead of updating the protected branch status in github, developers can update the needs section below
Expand Down
4 changes: 2 additions & 2 deletions lib/cfl/.github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ludeeus/action-shellcheck@master
with:
ignore_paths: lib
Expand All @@ -21,7 +21,7 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
Expand Down
10 changes: 5 additions & 5 deletions lib/cfl/.github/workflows/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
matrix:
format: [ rpm, deb ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: uraimo/run-on-arch-action@v3.0.1
name: Build the ${{matrix.format}} packages
with:
Expand All @@ -36,7 +36,7 @@ jobs:
echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {}

- name: Store the master package artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.format }}-arm64
path: |
Expand All @@ -51,14 +51,14 @@ jobs:

runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build the ${{matrix.format}} packages
run: |
cmake .
echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {}

- name: Store the master package artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.format }}-amd64
path: |
Expand All @@ -74,7 +74,7 @@ jobs:
contents: write
steps:
- name: Download all artefacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7
with:
path: artifacts/

Expand Down
76 changes: 76 additions & 0 deletions lib/cfl/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Repository Guidelines

## Preferred Commands
- Configure with tests: `cmake -S . -B build -DCFL_TESTS=On`
- Build: `cmake --build build -j8`
- Run all tests: `ctest --test-dir build --output-on-failure`
- Run a focused test: `ctest --test-dir build -R <name> --output-on-failure`
- Check staged or local patches for whitespace before closing a change:
`git diff --check`

## Project Structure & Module Organization
CFL is a small C library built with CMake.

- `include/cfl/`: public CFL headers.
- `src/`: library implementation files.
- `tests/`: acutest-based unit tests.
- `lib/xxhash/`: bundled xxHash dependency.
- `cmake/`: project CMake helpers.

Keep changes scoped to the affected module. Put public declarations in
`include/cfl/`, implementation in `src/`, and matching unit coverage in
`tests/` when behavior changes.

## Build, Test, and Development Commands
- `cmake -S . -B build -DCFL_TESTS=On`: configure the project with tests.
- `cmake --build build -j8`: compile the static library and tests.
- `ctest --test-dir build --output-on-failure`: run the enabled test suite.
- `ctest --test-dir build -R cfl-test-<name> --output-on-failure`: run a
focused unit test.

Prefer targeted test runs while iterating, then run the full enabled suite
before closing changes that touch shared code or public APIs.

## Coding Style & Naming Conventions
- Follow the existing Apache-style C conventions used in this repository.
- Use 4-space indentation and keep lines readable; avoid unnecessary wrapping.
- Always use braces for `if/else/while/do` blocks.
- Put function opening braces on the next line:
`int fn(void)\n{ ... }`
- Declare variables at the start of functions, not mid-block.
- Prefer descriptive `snake_case` names with the `cfl_` prefix for public APIs.
- Use `CFL_TRUE` and `CFL_FALSE` for CFL boolean-style return values.
- Use `/* ... */` comments, and add comments only where they clarify non-obvious
behavior.
- Keep public headers self-contained by including the standard headers they need.

## Testing Guidelines
- Add or update acutest unit coverage for behavior changes.
- Keep tests close to the affected module and name test binaries through
`tests/CMakeLists.txt`.
- Validate both success and failure paths for parsers, containers, allocation
handling, and boundary conditions.
- Run broader coverage when changing shared headers, CMake wiring, memory
ownership, or common data structures.
- If a relevant test cannot be run, report the exact blocker in the final
response.

## Commit & Pull Request Guidelines
- Follow observed local history style:
`component: short imperative description`
Examples: `sds: do not export internal sds_alloc function`,
`build: bump to v0.6.2`, `atomic: add atomic operations API`.
- Keep each commit scoped to one component or interface.
- Keep subject/body lines concise; use a body when the reason or scope is not
obvious from the subject.
- Do not mix unrelated code and documentation updates in one commit unless the
user explicitly asks for a combined commit.
- Do not rewrite history, amend commits, create remote branches, or open pull
requests unless explicitly requested.

## Agent Action Limits
- Do not modify repositories or files outside this project unless the user
explicitly asks.
- Do not revert user changes outside the requested scope.
- Preserve unrelated untracked or modified files in the worktree.
- Prefer minimal patches that avoid unrelated formatting or refactoring churn.
2 changes: 1 addition & 1 deletion lib/cfl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# C Floppy Version
set(CFL_VERSION_MAJOR 0)
set(CFL_VERSION_MINOR 6)
set(CFL_VERSION_MINOR 7)
set(CFL_VERSION_PATCH 1)
set(CFL_VERSION_STR "${CFL_VERSION_MAJOR}.${CFL_VERSION_MINOR}.${CFL_VERSION_PATCH}")
Comment on lines 6 to 10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the latest version of the cfl library (C Floppy library)?

💡 Result:

The “C Floppy library” (cfl) appears to refer to the fluent/cfl C-flavored library. Its latest released version is v0.6.1 (marked “Latest” and dated May 22, 2025 on the repository page). [1] Note: there are other unrelated software projects abbreviated “cfl” (e.g., “Causal Feature Learning”, “Compressed File Library”, etc.), so the name is ambiguous; the fluent/cfl repository is the only one in the sources explicitly describing “c:\ floppy” as “CFL”. [2]

Citations:


Update PR title and description or adjust version numbers for consistency.

The version configured in the code (0.7.1) does not match the PR title and description, which state "upgrade to v0.7.0." The computed version string will be "0.7.1", which flows through to package naming and release artifacts. Either update CFL_VERSION_PATCH to 0 (to match the stated v0.7.0), or update the PR title/description to "v0.7.1" for consistency.

Note: The upstream cfl library's latest released version is v0.6.1; the 0.7.x version does not yet have an official release.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/cfl/CMakeLists.txt` around lines 6 - 10, The CMake version variables
currently set (CFL_VERSION_MAJOR, CFL_VERSION_MINOR, CFL_VERSION_PATCH) compute
CFL_VERSION_STR as "0.7.1" which mismatches the PR text; either set
CFL_VERSION_PATCH to 0 so CFL_VERSION_STR becomes "0.7.0" or update the PR
title/description to "v0.7.1" for consistency—locate and edit the entries
CFL_VERSION_PATCH and CFL_VERSION_STR in lib/cfl/CMakeLists.txt (or update PR
metadata) so package naming and release artifacts match the declared version.


Expand Down
71 changes: 62 additions & 9 deletions lib/cfl/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,71 @@
# CFL

CFL is a tiny library that provides interfaces for data structures, originally created to satisfy the needs of Fluent Bit and other libraries used internally like CMetrics and CTraces projects.
CFL is a tiny C library that provides small data-structure and utility
interfaces. It was originally created to satisfy the needs of Fluent Bit and
related libraries such as CMetrics and CTraces.

note: The name doesn't mean anything specific, you can call it `c:\ floppy` if you want.
Note: The name does not mean anything specific; you can call it `c:\ floppy`
if you want.

## Interfaces

- cfl_sds: string manipulation
- cfl_list: linked list
- cfl_kv: key value pairs by using a linked list (cfl_list)
- cfl_array: array of elements
- cfl_variant: interface to manage contexts with vairant types
- cfl_time: time utilities
- cfl_hash: 64bit hashing functions
Applications can include `<cfl/cfl.h>` to pull in the common CFL interfaces.
Specialized headers are also available under `include/cfl/` when a caller only
needs one module.

### Core

- `cfl_init()`: initializes library-level facilities.
- `cfl_version()`: returns the CFL version string.
- `CFL_TRUE` and `CFL_FALSE`: common boolean-style constants used by CFL APIs.

### Data Structures

- `cfl_sds`: dynamic string storage with explicit length and allocation
tracking. It supports creation from strings or buffers, growth, concatenation,
formatted writes, length updates, and destruction.
- `cfl_list`: intrusive doubly linked list helpers. It provides initialization,
add, append, prepend, delete, concatenate, size, entry lookup, and safe
iteration macros.
- `cfl_kv`: SDS-backed string key/value entries stored in a `cfl_list`. This is
useful for simple string maps where values are plain strings.
- `cfl_variant`: tagged value container for bool, signed integer, unsigned
integer, double, null, reference, string, bytes, array, and key/value list
values.
- `cfl_array`: ordered collection of `cfl_variant` entries. It supports fixed
or resizable arrays, append helpers for all variant types, fetch by index,
removal, size inspection, and printing.
- `cfl_kvlist`: string-keyed map whose values are `cfl_variant` instances. It
supports typed insert helpers, size-aware key APIs, fetch, contains, remove,
count, and printing.
- `cfl_object`: generic wrapper that can hold a `cfl_kvlist`, `cfl_variant`, or
`cfl_array` and print the associated value.

### Utilities

- `cfl_atomic`: 64-bit atomic initialization, compare-exchange, store, and load
operations with platform-specific backends.
- `cfl_time`: wall-clock timestamp helper that returns nanoseconds.
- `cfl_hash`: naming wrappers around xxHash 64-bit and 128-bit hashing APIs.
- `cfl_checksum`: CRC32C checksum helper.
- `cfl_utils`: string split helpers, including quote-aware splitting, with
results returned as `cfl_list` entries.
- `cfl_log`: runtime error reporting helpers.

### Support Headers

- `cfl_compat`: platform compatibility macros.
- `cfl_found`: lightweight include-probe helper for parent projects.
- `cfl_info`: generated build information and feature flags.
- `cfl_version`: version macros.

## Build and Test

```sh
cmake -S . -B build -DCFL_TESTS=On
cmake --build build -j8
ctest --test-dir build --output-on-failure
```

## License

Expand Down
2 changes: 2 additions & 0 deletions lib/cfl/include/cfl/cfl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
#include <cfl/cfl_info.h>
#include <cfl/cfl_version.h>
#include <cfl/cfl_compat.h>
#include <cfl/cfl_atomic.h>
#include <cfl/cfl_log.h>
#include <cfl/cfl_sds.h>
#include <cfl/cfl_list.h>
#include <cfl/cfl_hash.h>
#include <cfl/cfl_array.h>
#include <cfl/cfl_kv.h>
#include <cfl/cfl_kvlist.h>
#include <cfl/cfl_checksum.h>
#include <cfl/cfl_time.h>
#include <cfl/cfl_variant.h>
#include <cfl/cfl_object.h>
Expand Down
Loading
Loading