Commit Graph
19 Commits
Author SHA1 Message Date
Yu Watanabe 4fc58bf621 iovec-wrapper: reintroduce iovw_free() and iovw_free_free()
They were dropped by the commit 267b16f33c,
but will be used later. Hence, let's reintroduce them.
2026-05-12 15:33:21 +09:00
Yu Watanabe 32729ae92f iovec-wrapper: introduce iovec_split() and iovw_merge()
In many network protocols, the length-prefixed data format is often
used. Let's add a simple parser and builder for the format.
2026-05-12 15:33:21 +09:00
Yu Watanabe fe6fed5d97 iovec-wrapper: introduce iovw_put_full() and friends to make them accept zero length entry
These will be used later. Preparation for later commits.
2026-05-12 15:33:21 +09:00
Yu Watanabe f71dcac4dc iovec-wrapper: introduce several more helper functions 2026-04-19 06:15:54 +09:00
Yu Watanabe 6d14614f4d iovec-wrapper: rename iovw_append() to iovw_extend()
The naming is consistent with strv_extend().

This also
- introduces tiny iovw_extend_iov() wrapper,
- refuse when the source and target points to the same object,
- check the final count before extending in iovw_extend_iovw().
2026-04-19 06:02:48 +09:00
Yu Watanabe d49c509d9b iovec-wrapper: introduce iovw_concat()
This is similar to iovw_to_cstring(), but allows embedded NUL, as this
just concat multiple iovec, the result may not be a string.

Now, iovw_to_cstring() internally uses iovw_concat().
2026-04-19 05:51:05 +09:00
Yu Watanabe a4e0f04157 iovec-wrapper: introduce iovw_compare() and iovw_equal() 2026-04-19 05:51:01 +09:00
Zbigniew Jędrzejewski-Szmek 13b6ba9775 basic/iovec-wrapper: fix potential memleak on error
Also reorder the functions in the call stack order.
2026-04-17 12:19:40 +02:00
Zbigniew Jędrzejewski-Szmek f32af5c69a basic/iovec-wrapper: add iovw_append and iovw_to_cstring
Existing iovw_append is renamed to iovw_append_iovw.
iovw_consume is made noninline.
2026-04-16 20:37:18 +02:00
Zbigniew Jędrzejewski-Szmek 267b16f33c basic/iovec-wrapper: drop unused code
All non-test users iovec_wrapper define the struct as a field in a
bigger structure, so we never free it individually. Let's simplify the
code and assume it is never null.
2026-04-16 17:21:56 +02:00
Yu Watanabe d10596a6e0 iovec-wrapper: introduce iovw_put_string_fieldf() 2025-10-19 10:01:46 +09:00
Yu Watanabe a5cdc2be70 iovec-wrapper: introduce iovw_replace_string_field() 2025-10-19 10:01:46 +09:00
Daan De Meyer f102bc3e5f tree-wide: Introduce sd-forward.h and shared-forward.h headers
Let's not leak details from src/shared and src/libsystemd into
src/basic, even though you can't actually do anything useful with
just forward declarations from src/shared.

The sd-forward.h header is put in src/libsystemd/sd-common as we
don't have a directory for shared internal headers for libsystemd
yet.

Let's also rename forward.h to basic-forward.h to keep things
self-explanatory.
2025-10-16 17:00:29 +02:00
Daan De Meyer 0c15577abe basic + fundamental: Clean up includes
Split out of #37344.
2025-05-25 10:06:07 +02:00
Daan De Meyer 401a22bfc1 tree-wide: Make sure all headers are standalone
Let's make sure all of our headers include everything they require.
2025-04-23 10:33:38 +02:00
Lennart Poettering 0e3e075b56 iovw: normalize destructors
instead of passing a boolean picking the destruction method just have
different functions. That's much nicer in context of _cleanup_, and how
we usually do things.
2024-10-31 23:08:11 +01:00
Lennart Poettering 811aa36ab6 iovw: add simpler iovw_done() destructor 2024-10-31 23:08:11 +01:00
Lennart Poettering 2865561eaa coredump: move to _cleanup_ for destroying iovw object 2024-10-31 23:08:11 +01:00
Lennart Poettering ea1f38146a io-util: split out iovw_xyz into iovec-wrapper.h
Let's split these APIs out, they are kinda their own thing.
2023-10-20 10:43:50 +02:00