| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We recently started making more use of malloc_usable_size() and rely on
it (see the string_erase() story). Given that we don't really support
sytems where malloc_usable_size() cannot be trusted beyond statistics
anyway, let's go fully in and rework GREEDY_REALLOC() on top of it:
instead of passing around and maintaining the currenly allocated size
everywhere, let's just derive it automatically from
malloc_usable_size().
I am mostly after this for the simplicity this brings. It also brings
minor efficiency improvements I guess, but things become so much nicer
to look at if we can avoid these allocation size variables everywhere.
Note that the malloc_usable_size() man page says relying on it wasn't
"good programming practice", but I think it does this for reasons that
don't apply here: the greedy realloc logic specifically doesn't rely on
the returned extra size, beyond the fact that it is equal or larger than
what was requested.
(This commit was supposed to be a quick patch btw, but apparently we use
the greedy realloc stuff quite a bit across the codebase, so this ends
up touching *a*lot* of code.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
supposed-to-be-public APIs
This drops the "const" specifier from the opaque object parameters to
various functions in our API.
This effectively reverts #19292 and more.
Why drop this? Our public APIs should not leak too much information
about how stuff is implemented internally. In our public APIs we
shouldn't give too many guarantees we don#t want to necessarily keep.
Specifically: in many cases it makes sense that getters actually
generate/parse/allocate data on the fly, storing/caching the result
internally, to speed things up, do things lazily or to track memory
allocations so that they can be freed later. Doing this means we need to
change the objects, even though the getters are semantically a read
operation.
We want to retain the freedom that we can change things around
internally. By exposing the objects as "const" we remove a good chunk of
that, for little gain.
See sd_bus_creds_get_description() for a real example of a getter that
implicitly caches and thus modifies the relevant object.
This removes the "const" decorators from sd-dhcp and sd-netlink, two
APIs that we intend to make public eventually even though they still are
not, leaving us the chance to still fix this before it becomes set in
stone.
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| | |
keszybz/check-return-values-from-log_errno-functions
Check return values from log_errno functions
|
| | |
|
| |
| |
| |
| | |
No functional change.
|
| | |
|
| |
| |
| |
| |
| |
| | |
We were writing to the wrong buffer with a wrong offset :(
Bug present since the original introduction of the code in
04b28be1a306fd2ba454d3ee333d63df71aa3873.
|
| |
| |
| |
| |
| |
| | |
We were writing to the wrong buffer with a wrong offset :(
Bug present since the original introduction of the code in
04b28be1a306fd2ba454d3ee333d63df71aa3873.
|
|/ |
|
|
|
|
|
|
|
| |
With some versions of the compiler, the _cleanup_ attr makes it think
the variable might be freed/closed when uninitialized, even though it
cannot happen. The added cost is small enough to be worth the benefit,
and optimized builds will help reduce it even further.
|
| |
|
| |
|
| |
|
|\
| |
| | |
network: set ifname to dhcp4 client or friends
|
| |
| |
| |
| |
| | |
Only when T1 and T2 are both 0, they are adjusted later based on
address or prefix T1 and T2. So the first check must be changed.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Same as 7489d0640a4864d4b47fd8fda77f8eb7cf2e3fe8, one more case
that was missed.
Coverity CID #1394277
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Static analyzers need a hint that optval is not pointing
off the end of the msg_advertise array, since pos can go
up to the full length of it. The array is manually
constructed so we know this won't happen, but adding one
more assert should be enough to avoid false positives.
Coverity CID #1394277
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes an issue introduced by 73b49d433c2c8e6304c8b82538bd4231d070fce4.
When PrefixDelegationHint= is not set, dhcp6_option_append_pd() sets
wrong length for IA_PD option, as `r` is `-EINVAL`.
Fixes #19021.
|
|\ \
| | |
| | | |
tree-wide: use UINT64_MAX or friends
|
| | | |
|
|/ /
| |
| |
| |
| |
| | |
option on DHCP_OFFER
Fixes #15780.
|
|/ |
|
|\
| |
| | |
dhcp6: do not set T1 and T2 in IA_PD option or friends
|
| |
| |
| |
| | |
Fixes #18090.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
received address or prefix is refused
And then the caller ignores the error.
Otherwise, `ret_liftime_valid` is not set even if they succeeds.
|
| | |
|
|/
|
|
| |
Coverity 1446712
|
|
|
|
|
|
|
|
|
|
|
|
| |
Apparently, in our current public headers (i.e. those called sd-*.h) we
suffixed typedefs that we use as values with _t, but we didn't do this
for enum typedefs. Fix that while this stuff is not actually public yet.
With this scheme "value typedefs" now end systematically in _t, and
"object typedefs" (i.e. structures that are typically passed around via
pointers and not values) do not.
No code changes, just some renaming.
|
| |
|
| |
|
| |
|
|
|
|
| |
Follow-up of #11484
|
|
|
|
|
|
| |
I started working on this because I wanted to change how
DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's
nice to make make things more consistent and predictable.
|
|
|
|
|
|
|
|
|
| |
As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617.
This does not touch anything exposed in src/systemd. Changing the defines there
would be a compatibility break.
Note that tests are broken after this commit. They will be fixed in the next one.
|
|\
| |
| | |
network: do not trigger unnecessary network events
|
| | |
|
|/
|
|
| |
Also use _cleanup_free_ in one more place.
|
|\
| |
| | |
meson: various cleanups
|
| | |
|
| |
| |
| |
| | |
But, still sd-id128 is used in src/basic.
|
| | |
|
|/ |
|
| |
|