| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes strjoin and strjoina more similar and avoids the useless final
argument.
spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c)
git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/'
This might have missed a few cases (spatch has a really hard time dealing
with _cleanup_ macros), but that's no big issue, they can always be fixed
later.
|
|
|
|
|
|
| |
It's a common pattern, so add a helper for it. A macro is necessary
because a function that takes a pointer to a pointer would be type specific,
similarly to cleanup functions. Seems better to use a macro.
|
| |
|
|
|
| |
Super-important change, yeah!
|
|
|
|
| |
The coccinelle patch didn't work in some places, I have no idea why.
|
|
|
|
| |
Also add a coccinelle receipt to help with such transitions.
|
|
|
|
|
|
|
|
| |
rewrites:
log_error_errno(errno, ...);
return -errno;
into:
return log_error_errno(errno, ...);
|
|
|
|
| |
Apply to all log_*_errno loglevels.
|
| |
|
| |
|
|
|
|
|
|
| |
And set_free() too.
Another Coccinelle patch.
|
|
|
|
| |
Another Coccinelle patch.
|
|\
| |
| | |
util: introduce safe_fclose() and port everything over to it
|
| |
| |
| |
| | |
Adds a coccinelle script to port things over automatically.
|
| |
| |
| |
| | |
Another Coccinelle script.
|
| |
| |
| |
| | |
Let's also clean up single-line while and for blocks.
|
|/
|
|
|
|
|
| |
The previous coccinelle semantic patch that improved usage of
log_error_errno()'s return value, only looked for log_error_errno()
invocations with a single parameter after the error parameter. Update
the patch to handle arbitrary numbers of additional arguments.
|
|
|
|
| |
Patch via coccinelle.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turns this:
r = -errno;
log_error_errno(errno, "foo");
into this:
r = log_error_errno(errno, "foo");
and this:
r = log_error_errno(errno, "foo");
return r;
into this:
return log_error_errno(errno, "foo");
|
|
|
|
|
|
|
|
|
|
|
| |
Turn this:
if ((r = foo()) < 0) { ...
into this:
r = foo();
if (r < 0) { ...
|
|
|
|
|
|
|
|
|
|
|
| |
Replace this:
if (fd >= 0)
safe_close(fd);
by this:
safe_close(fd);
|
|
|
|
|
|
|
|
|
|
|
| |
Replace this:
close(fd);
fd = -1;
write this:
fd = safe_close(fd);
|
|
This replaces this:
free(p);
p = NULL;
by this:
p = mfree(p);
Change generated using coccinelle. Semantic patch is added to the
sources.
|