From 5d13a15b1d0bd7d218100d204a84eaaaaeab932f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 19 Apr 2018 12:13:23 +0200 Subject: [PATCH] tree-wide: drop spurious newlines (#8764) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Double newlines (i.e. one empty lines) are great to structure code. But let's avoid triple newlines (i.e. two empty lines), quadruple newlines, quintuple newlines, …, that's just spurious whitespace. It's an easy way to drop 121 lines of code, and keeps the coding style of our sources a bit tigther. --- man/file-hierarchy.xml | 1 - man/journal-remote.conf.xml | 1 - man/journald.conf.xml | 1 - man/sd-id128.xml | 1 - man/sd_get_seats.xml | 1 - man/sd_journal_get_catalog.xml | 1 - man/systemd-journal-upload.xml | 1 - man/systemd.exec.xml | 3 -- man/systemd.network.xml | 1 - man/systemd.timer.xml | 1 - src/analyze/analyze.c | 2 -- src/basic/format-table.c | 1 - src/basic/hash-funcs.c | 1 - src/basic/mount-util.c | 1 - src/basic/random-util.c | 1 - src/basic/ratelimit.c | 1 - src/basic/selinux-util.c | 1 - src/basic/socket-util.c | 2 -- src/boot/efi/measure.c | 1 - src/busctl/busctl-introspect.c | 1 - src/busctl/busctl.c | 3 -- src/core/audit-fd.c | 1 - src/core/cgroup.c | 1 - src/core/dbus-execute.c | 5 --- src/core/dbus-socket.c | 2 -- src/core/execute.c | 1 - src/core/job.c | 1 - src/core/killall.c | 1 - src/core/load-dropin.c | 1 - src/core/load-fragment.c | 2 -- src/core/transaction.c | 1 - src/core/umount.c | 1 - src/core/unit.c | 1 - src/cryptsetup/cryptsetup-generator.c | 1 - src/hostname/hostnamed.c | 1 - src/journal-remote/journal-gatewayd.c | 1 - src/journal-remote/journal-remote.c | 2 -- src/journal-remote/journal-upload.c | 2 -- src/journal-remote/microhttpd-util.c | 1 - src/journal/catalog.c | 1 - src/journal/compress.c | 2 -- src/journal/journalctl.c | 3 -- src/journal/journald-server.c | 1 - src/journal/lookup3.c | 8 ----- src/libsystemd-network/lldp-neighbor.c | 1 - src/libsystemd-network/network-internal.c | 1 - src/libsystemd-network/test-dhcp6-client.c | 1 - src/libsystemd/sd-bus/bus-creds.c | 2 -- src/libsystemd/sd-bus/bus-match.c | 1 - src/libsystemd/sd-bus/bus-message.c | 2 -- src/libsystemd/sd-bus/bus-signature.c | 1 - src/libsystemd/sd-bus/bus-slot.c | 1 - src/libsystemd/sd-bus/sd-bus.c | 1 - src/libsystemd/sd-netlink/netlink-message.c | 1 - src/libsystemd/sd-netlink/test-netlink.c | 1 - src/locale/localed.c | 1 - src/login/logind-session.c | 1 - src/machine/machinectl.c | 1 - src/network/netdev/dummy.c | 1 - src/network/netdev/geneve.c | 1 - src/network/netdev/wireguard.c | 2 -- src/network/networkd-link.c | 1 - src/nspawn/nspawn.c | 1 - src/path/path.c | 1 - src/resolve/resolvconf-compat.c | 1 - src/resolve/resolved-dns-rr.c | 1 - src/resolve/resolved-dns-transaction.c | 2 -- src/shared/bus-unit-util.c | 1 - src/shared/fdset.c | 1 - src/shared/firewall-util.c | 1 - src/shared/import-util.c | 1 - src/shared/logs-show.c | 2 -- src/shared/utmp-wtmp.c | 1 - src/sysusers/sysusers.c | 1 - src/test/test-exec-util.c | 1 - src/test/test-fileio.c | 1 - src/test/test-job-type.c | 1 - src/test/test-libudev.c | 1 - src/test/test-locale-util.c | 1 - src/test/test-nss.c | 2 -- src/test/test-parse-util.c | 1 - src/test/test-path.c | 1 - src/test/test-stat-util.c | 1 - src/test/test-string-util.c | 1 - src/test/test-strv.c | 1 - src/test/test-unit-file.c | 1 - src/test/test-unit-name.c | 1 - src/udev/mtd_probe/probe_smartmedia.c | 1 - src/udev/scsi_id/scsi_serial.c | 1 - src/udev/udevd.c | 2 -- tools/find-double-newline.sh | 40 +++++++++++++++++++++ 91 files changed, 40 insertions(+), 121 deletions(-) create mode 100755 tools/find-double-newline.sh diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml index 423bb3a12dc..37cb2002d4d 100644 --- a/man/file-hierarchy.xml +++ b/man/file-hierarchy.xml @@ -565,7 +565,6 @@ - Unprivileged Write Access diff --git a/man/journal-remote.conf.xml b/man/journal-remote.conf.xml index 24ade09023a..db5e4efd5b2 100644 --- a/man/journal-remote.conf.xml +++ b/man/journal-remote.conf.xml @@ -70,7 +70,6 @@ - SplitMode= diff --git a/man/journald.conf.xml b/man/journald.conf.xml index 96422a3a2f3..760d649a3df 100644 --- a/man/journald.conf.xml +++ b/man/journald.conf.xml @@ -276,7 +276,6 @@ seconds. - SyncIntervalSec= diff --git a/man/sd-id128.xml b/man/sd-id128.xml index 124bb3384e7..f7a147ab305 100644 --- a/man/sd-id128.xml +++ b/man/sd-id128.xml @@ -114,7 +114,6 @@ int main(int argc, char **argv) { } - SD_ID128_CONST_STR() may be used to convert constant 128-bit IDs into constant strings for output. The following example code will output the string diff --git a/man/sd_get_seats.xml b/man/sd_get_seats.xml index a5906fbfbb6..63659f8cd17 100644 --- a/man/sd_get_seats.xml +++ b/man/sd_get_seats.xml @@ -106,7 +106,6 @@ errno-style error code. - Errors diff --git a/man/sd_journal_get_catalog.xml b/man/sd_journal_get_catalog.xml index 6974c7437c9..85aa189d4ff 100644 --- a/man/sd_journal_get_catalog.xml +++ b/man/sd_journal_get_catalog.xml @@ -53,7 +53,6 @@ char **ret - diff --git a/man/systemd-journal-upload.xml b/man/systemd-journal-upload.xml index fc3ecd2fdcb..900706a34d6 100644 --- a/man/systemd-journal-upload.xml +++ b/man/systemd-journal-upload.xml @@ -147,7 +147,6 @@ - =PATH diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 3c30f817c93..b2ac0a26558 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -353,7 +353,6 @@ CapabilityBoundingSet=~CAP_B CAP_C - Security @@ -746,7 +745,6 @@ CapabilityBoundingSet=~CAP_B CAP_C - Sandboxing @@ -2637,5 +2635,4 @@ StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy - diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 0da884591af..b71e197f113 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1369,7 +1369,6 @@ - [DHCPServer] Section Options The [DHCPServer] section contains diff --git a/man/systemd.timer.xml b/man/systemd.timer.xml index 76a8dc4d8cd..fea7f3ff72b 100644 --- a/man/systemd.timer.xml +++ b/man/systemd.timer.xml @@ -263,7 +263,6 @@ suffix. - Persistent= diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index f69264d6377..179bb0f7999 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -118,7 +118,6 @@ struct host_info { char *architecture; }; - static int acquire_systemd_bus(sd_bus **bus) { bool user = arg_scope != UNIT_FILE_SYSTEM; @@ -565,7 +564,6 @@ static int pretty_boot_time(sd_bus *bus, char **_buf) { else if (!unit_id) size = strpcpyf(&ptr, size, "\ncould not find default.target"); - ptr = strdup(buf); if (!ptr) return log_oom(); diff --git a/src/basic/format-table.c b/src/basic/format-table.c index 36873fd397b..ae2c6238c4e 100644 --- a/src/basic/format-table.c +++ b/src/basic/format-table.c @@ -855,7 +855,6 @@ static const char *table_data_format(TableData *d) { assert_not_reached("Unexpected type?"); } - return d->formatted; } diff --git a/src/basic/hash-funcs.c b/src/basic/hash-funcs.c index b62f2bd877e..13e357efd4b 100644 --- a/src/basic/hash-funcs.c +++ b/src/basic/hash-funcs.c @@ -24,7 +24,6 @@ const struct hash_ops string_hash_ops = { .compare = string_compare_func }; - void path_hash_func(const void *p, struct siphash *state) { const char *q = p; size_t n; diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c index 7c36d78cc68..a6efbc3a7be 100644 --- a/src/basic/mount-util.c +++ b/src/basic/mount-util.c @@ -856,7 +856,6 @@ const char *mount_propagation_flags_to_string(unsigned long flags) { return NULL; } - int mount_propagation_flags_from_string(const char *name, unsigned long *ret) { if (isempty(name)) diff --git a/src/basic/random-util.c b/src/basic/random-util.c index 5095cee91b0..1623932f18e 100644 --- a/src/basic/random-util.c +++ b/src/basic/random-util.c @@ -109,7 +109,6 @@ void initialize_srand(void) { #endif x = 0; - x ^= (unsigned) now(CLOCK_REALTIME); x ^= (unsigned) gettid(); diff --git a/src/basic/ratelimit.c b/src/basic/ratelimit.c index 5e096b8f994..6598b1a812e 100644 --- a/src/basic/ratelimit.c +++ b/src/basic/ratelimit.c @@ -5,7 +5,6 @@ Copyright 2010 Lennart Poettering ***/ - #include #include "macro.h" diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c index 6f370f9cba8..aba3e4f15d8 100644 --- a/src/basic/selinux-util.c +++ b/src/basic/selinux-util.c @@ -315,7 +315,6 @@ char* mac_selinux_free(char *label) { if (!mac_selinux_use()) return NULL; - freecon(label); #endif diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index 7766229822f..95a79f7b530 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -664,7 +664,6 @@ int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ return -EOPNOTSUPP; } - *ret = p; return 0; } @@ -1127,7 +1126,6 @@ int flush_accept(int fd) { }; int r; - /* Similar to flush_fd() but flushes all incoming connection by accepting them and immediately closing them. */ for (;;) { diff --git a/src/boot/efi/measure.c b/src/boot/efi/measure.c index 5aaffe8fa52..ffdc4dcaf70 100644 --- a/src/boot/efi/measure.c +++ b/src/boot/efi/measure.c @@ -188,7 +188,6 @@ typedef struct tdEFI_TCG2_PROTOCOL { EFI_TCG2_GET_RESULT_OF_SET_ACTIVE_PCR_BANKS GetResultOfSetActivePcrBanks; } EFI_TCG2; - static EFI_STATUS tpm1_measure_to_pcr_and_event_log(const EFI_TCG *tcg, UINT32 pcrindex, const EFI_PHYSICAL_ADDRESS buffer, UINTN buffer_size, const CHAR16 *description) { EFI_STATUS status; diff --git a/src/busctl/busctl-introspect.c b/src/busctl/busctl-introspect.c index c2118b62968..fc384464d6e 100644 --- a/src/busctl/busctl-introspect.c +++ b/src/busctl/busctl-introspect.c @@ -544,7 +544,6 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth break; - case STATE_SIGNAL_ARG: if (t == XML_ATTRIBUTE_NAME) { diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index 419d75f53ee..f19edfd9874 100644 --- a/src/busctl/busctl.c +++ b/src/busctl/busctl.c @@ -1462,7 +1462,6 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char break; } - case SD_BUS_TYPE_DOUBLE: { double z; @@ -1980,7 +1979,6 @@ static int parse_argv(int argc, char *argv[]) { arg_expect_reply = !!r; break; - case ARG_AUTO_START: r = parse_boolean(optarg); if (r < 0) { @@ -1991,7 +1989,6 @@ static int parse_argv(int argc, char *argv[]) { arg_auto_start = !!r; break; - case ARG_ALLOW_INTERACTIVE_AUTHORIZATION: r = parse_boolean(optarg); if (r < 0) { diff --git a/src/core/audit-fd.c b/src/core/audit-fd.c index ad19d327d31..4a522c61ac5 100644 --- a/src/core/audit-fd.c +++ b/src/core/audit-fd.c @@ -5,7 +5,6 @@ Copyright 2012 Lennart Poettering ***/ - #include #include "audit-fd.h" diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 1308bc195c4..426732483ef 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -1692,7 +1692,6 @@ static void unit_remove_from_cgroup_realize_queue(Unit *u) { u->in_cgroup_realize_queue = false; } - /* Check if necessary controllers and attributes for a unit are in place. * * If so, do nothing. diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 09dc93e53b0..e36a050bdd8 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -100,7 +100,6 @@ static int property_get_oom_score_adjust( void *userdata, sd_bus_error *error) { - ExecContext *c = userdata; int32_t n; @@ -130,7 +129,6 @@ static int property_get_nice( void *userdata, sd_bus_error *error) { - ExecContext *c = userdata; int32_t n; @@ -159,7 +157,6 @@ static int property_get_ioprio( void *userdata, sd_bus_error *error) { - ExecContext *c = userdata; assert(bus); @@ -178,7 +175,6 @@ static int property_get_ioprio_class( void *userdata, sd_bus_error *error) { - ExecContext *c = userdata; assert(bus); @@ -197,7 +193,6 @@ static int property_get_ioprio_priority( void *userdata, sd_bus_error *error) { - ExecContext *c = userdata; assert(bus); diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index 4e751478b18..89bc5c0a1bd 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -33,7 +33,6 @@ static int property_get_listen( void *userdata, sd_bus_error *error) { - Socket *s = SOCKET(userdata); SocketPort *p; int r; @@ -79,7 +78,6 @@ static int property_get_listen( return sd_bus_message_close_container(reply); } - static int property_get_fdname( sd_bus *bus, const char *path, diff --git a/src/core/execute.c b/src/core/execute.c index 6ded96571a5..be44166ce37 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -4839,7 +4839,6 @@ int exec_runtime_deserialize_compat(Unit *u, const char *key, const char *value, } else return 0; - /* If the object is newly created, then put it to the hashmap which manages ExecRuntime objects. */ if (rt_create) { r = hashmap_put(u->manager->exec_runtime_by_id, rt_create->id, rt_create); diff --git a/src/core/job.c b/src/core/job.c index ae956fa2fcc..4581dd520ee 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -563,7 +563,6 @@ int job_run_and_invalidate(Job *j) { job_set_state(j, JOB_RUNNING); job_add_to_dbus_queue(j); - switch (j->type) { case JOB_VERIFY_ACTIVE: { diff --git a/src/core/killall.c b/src/core/killall.c index 69068589186..29db2ae7e33 100644 --- a/src/core/killall.c +++ b/src/core/killall.c @@ -198,7 +198,6 @@ static int killall(int sig, Set *pids, bool send_sighup) { make sure to only send this after SIGTERM so that SIGTERM is always first in the queue. */ - if (get_ctty_devnr(pid, NULL) >= 0) /* it's OK if the process is gone, just ignore the result */ (void) kill(pid, SIGHUP); diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index 0a56f0df864..9e54614cdee 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -5,7 +5,6 @@ Copyright 2010 Lennart Poettering ***/ - #include "conf-parser.h" #include "fs-util.h" #include "load-dropin.h" diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 61e752ad3e1..c0b1fbe5257 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -1166,7 +1166,6 @@ int config_parse_exec_cpu_sched_policy(const char *unit, void *data, void *userdata) { - ExecContext *c = data; int x; @@ -1458,7 +1457,6 @@ int config_parse_exec_mount_flags( void *data, void *userdata) { - ExecContext *c = data; int r; diff --git a/src/core/transaction.c b/src/core/transaction.c index 930b3f406b0..70e78237b57 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -920,7 +920,6 @@ int transaction_add_job_and_dependencies( "Job type %s is not applicable for unit %s.", job_type_to_string(type), unit->id); - /* First add the job. */ ret = transaction_add_one_job(tr, type, unit, &is_new); if (!ret) diff --git a/src/core/umount.c b/src/core/umount.c index 870194a46b6..017162f2fb3 100644 --- a/src/core/umount.c +++ b/src/core/umount.c @@ -111,7 +111,6 @@ int mount_points_list_get(const char *mountinfo, MountPoint **head) { path_startswith(p, "/proc")) continue; - /* If we are in a container, don't attempt to * read-only mount anything as that brings no real * benefits, but might confuse the host, as we remount diff --git a/src/core/unit.c b/src/core/unit.c index 01e7cc96834..09574da5ce1 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3592,7 +3592,6 @@ void unit_deserialize_skip(FILE *f) { } } - int unit_add_node_dependency(Unit *u, const char *what, bool wants, UnitDependency dep, UnitDependencyMask mask) { Unit *device; _cleanup_free_ char *e = NULL; diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index 113ee59bd9f..4103e0eed68 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -160,7 +160,6 @@ static int create_disk( "RequiresMountsFor=%s\n", u_escaped); - r = generator_write_timeouts(arg_dest, device, name, options, &filtered); if (r < 0) return r; diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index f847a7314b7..c73390cfdf5 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -248,7 +248,6 @@ static char* context_fallback_icon_name(Context *c) { return strdup("computer"); } - static bool hostname_is_useful(const char *hn) { return !isempty(hn) && !is_localhost(hn); } diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 27544c8ae50..7399d3315f0 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -835,7 +835,6 @@ static int request_handler( if (!streq(method, "GET")) return mhd_respond(connection, MHD_HTTP_NOT_ACCEPTABLE, "Unsupported method."); - if (!*connection_cls) { if (!request_meta(connection_cls)) return respond_oom(connection); diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 86d541a17c0..995083655a8 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -686,7 +686,6 @@ static int setup_microhttpd_server(RemoteServer *s, log_debug("Started MHD %s daemon on fd:%d (wrapper @ %p)", key ? "HTTPS" : "HTTP", fd, d); - info = MHD_get_daemon_info(d->daemon, MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY); if (!info) { log_error("µhttp returned NULL daemon info"); @@ -1577,7 +1576,6 @@ int main(int argc, char **argv) { if (r <= 0) return r == 0 ? EXIT_SUCCESS : EXIT_FAILURE; - if (arg_listen_http || arg_listen_https) { r = setup_gnutls_logger(arg_gnutls_log); if (r < 0) diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 6df87560fbd..5194b3136f6 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -167,8 +167,6 @@ static int load_cursor_state(Uploader *u) { return 0; } - - int start_upload(Uploader *u, size_t (*input_callback)(void *ptr, size_t size, diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c index 17fa48fe5b9..9cb7dfc9203 100644 --- a/src/journal-remote/microhttpd-util.c +++ b/src/journal-remote/microhttpd-util.c @@ -33,7 +33,6 @@ void microhttpd_logger(void *arg, const char *fmt, va_list ap) { REENABLE_WARNING; } - static int mhd_respond_internal(struct MHD_Connection *connection, enum MHD_RequestTerminationCode code, const char *buffer, diff --git a/src/journal/catalog.c b/src/journal/catalog.c index 9578ffffe58..9c13d7b46d6 100644 --- a/src/journal/catalog.c +++ b/src/journal/catalog.c @@ -681,7 +681,6 @@ static void dump_catalog_entry(FILE *f, sd_id128_t id, const char *s, bool oneli SD_ID128_FORMAT_VAL(id), s); } - int catalog_list(FILE *f, const char *database, bool oneline) { _cleanup_close_ int fd = -1; void *p = NULL; diff --git a/src/journal/compress.c b/src/journal/compress.c index db816aa6ab4..c09dbb1778c 100644 --- a/src/journal/compress.c +++ b/src/journal/compress.c @@ -117,7 +117,6 @@ int compress_blob_lz4(const void *src, uint64_t src_size, #endif } - int decompress_blob_xz(const void *src, uint64_t src_size, void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max) { @@ -231,7 +230,6 @@ int decompress_blob(int compression, return -EBADMSG; } - int decompress_startswith_xz(const void *src, uint64_t src_size, void **buffer, size_t *buffer_size, const void *prefix, size_t prefix_len, diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 948bdd1cb23..907f32bf8da 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -716,7 +716,6 @@ static int parse_argv(int argc, char *argv[]) { arg_action = ACTION_SETUP_KEYS; break; - case ARG_VERIFY_KEY: arg_action = ACTION_VERIFY; r = free_and_strdup(&arg_verify_key, optarg); @@ -969,7 +968,6 @@ static int parse_argv(int argc, char *argv[]) { arg_system_units = strv_free(arg_system_units); } - #if HAVE_PCRE2 if (arg_pattern) { unsigned flags; @@ -1644,7 +1642,6 @@ static int add_priorities(sd_journal *j) { return 0; } - static int add_syslog_identifier(sd_journal *j) { int r; char **i; diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 13af80bcb48..391fc417eb6 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -167,7 +167,6 @@ static void patch_min_use(JournalStorage *storage) { storage->metrics.min_use = MAX(storage->metrics.min_use, storage->space.vfs_used); } - static int determine_space(Server *s, uint64_t *available, uint64_t *limit) { JournalStorage *js; int r; diff --git a/src/journal/lookup3.c b/src/journal/lookup3.c index ec725ce46cc..ec241d2f36d 100644 --- a/src/journal/lookup3.c +++ b/src/journal/lookup3.c @@ -214,7 +214,6 @@ uint32_t initval) /* the previous hash, or an arbitrary value */ return c; } - /* -------------------------------------------------------------------- hashword2() -- same as hashword(), but take two seeds and return two @@ -260,7 +259,6 @@ uint32_t *pb) /* IN: more seed OUT: secondary hash value */ *pc=c; *pb=b; } - /* ------------------------------------------------------------------------------- hashlittle() -- hash a variable-length key into a 32-bit value @@ -458,7 +456,6 @@ uint32_t jenkins_hashlittle( const void *key, size_t length, uint32_t initval) return c; } - /* * hashlittle2: return 2 32-bit hash values * @@ -644,8 +641,6 @@ void jenkins_hashlittle2( *pc=c; *pb=b; } - - /* * hashbig(): * This is the same as hashword() on big-endian machines. It is different @@ -775,7 +770,6 @@ uint32_t jenkins_hashbig( const void *key, size_t length, uint32_t initval) return c; } - #ifdef SELF_TEST /* used for timings */ @@ -967,7 +961,6 @@ void driver3() uint8_t buf[1]; uint32_t h,i,state[HASHSTATE]; - buf[0] = ~0; for (i=0; inode_vtable.interface; key.member = v->x.method.member; - x = hashmap_remove(slot->bus->vtable_properties, &key); break; }} diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index e5966cfe2ef..0c38589c2d4 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -3677,7 +3677,6 @@ _public_ int sd_bus_default_system(sd_bus **ret) { return bus_default(sd_bus_open_system, &default_system_bus, ret); } - _public_ int sd_bus_default_user(sd_bus **ret) { return bus_default(sd_bus_open_user, &default_user_bus, ret); } diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c index 6449d421b34..3b792dd5a7b 100644 --- a/src/libsystemd/sd-netlink/netlink-message.c +++ b/src/libsystemd/sd-netlink/netlink-message.c @@ -298,7 +298,6 @@ int sd_netlink_message_append_u8(sd_netlink_message *m, unsigned short type, uin return 0; } - int sd_netlink_message_append_u16(sd_netlink_message *m, unsigned short type, uint16_t data) { int r; diff --git a/src/libsystemd/sd-netlink/test-netlink.c b/src/libsystemd/sd-netlink/test-netlink.c index dfbb76f61fc..3ef611d165a 100644 --- a/src/libsystemd/sd-netlink/test-netlink.c +++ b/src/libsystemd/sd-netlink/test-netlink.c @@ -107,7 +107,6 @@ static void test_link_get(sd_netlink *rtnl, int ifindex) { assert_se((r = sd_netlink_message_unref(r)) == NULL); } - static void test_address_get(sd_netlink *rtnl, int ifindex) { sd_netlink_message *m; sd_netlink_message *r; diff --git a/src/locale/localed.c b/src/locale/localed.c index 84399bbe93f..4559168d007 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -343,7 +343,6 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er } else log_debug("Locale settings were not modified."); - return sd_bus_reply_method_return(m, NULL); } diff --git a/src/login/logind-session.c b/src/login/logind-session.c index d9277501d20..eb131ae50ce 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -254,7 +254,6 @@ int session_save(Session *s) { if (s->desktop) { _cleanup_free_ char *escaped; - escaped = cescape(s->desktop); if (!escaped) { r = -ENOMEM; diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index b2909a76a2f..d038e78d196 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -1062,7 +1062,6 @@ static int show_pool_info(sd_bus *bus) { return 0; } - static int show_image_properties(sd_bus *bus, const char *path, bool *new_line) { int r; diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c index 6a4390ea2db..26f58a52a66 100644 --- a/src/network/netdev/dummy.c +++ b/src/network/netdev/dummy.c @@ -6,7 +6,6 @@ Copyright 2014 Tom Gundersen ***/ - #include "netdev/dummy.h" const NetDevVTable dummy_vtable = { diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c index 150947c9e0f..03039439810 100644 --- a/src/network/netdev/geneve.c +++ b/src/network/netdev/geneve.c @@ -150,7 +150,6 @@ static int netdev_geneve_create(NetDev *netdev) { log_netdev_debug(netdev, "Creating"); - return r; } diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c index a1c1c2a51f2..c79f2d283d6 100644 --- a/src/network/netdev/wireguard.c +++ b/src/network/netdev/wireguard.c @@ -315,7 +315,6 @@ static void resolve_endpoints(NetDev *netdev) { } } - static int netdev_wireguard_post_create(NetDev *netdev, Link *link, sd_netlink_message *m) { Wireguard *w; @@ -455,7 +454,6 @@ int config_parse_wireguard_preshared_key(const char *unit, peer->preshared_key); } - int config_parse_wireguard_public_key(const char *unit, const char *filename, unsigned line, diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index c921f92d148..d2ec6ce9d6e 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1150,7 +1150,6 @@ static int link_enter_set_addresses(Link *link) { log_link_warning_errno(link, r, "Failed to set DNS server for DHCP server, ignoring: %m"); } - if (link->network->dhcp_server_emit_ntp) { if (link->network->n_dhcp_server_ntp > 0) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 7169c115765..a507c49b344 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1897,7 +1897,6 @@ static int reset_audit_loginuid(void) { return 0; } - static int setup_propagate(const char *root) { const char *p, *q; int r; diff --git a/src/path/path.c b/src/path/path.c index 52758457501..ea6442991b0 100644 --- a/src/path/path.c +++ b/src/path/path.c @@ -181,7 +181,6 @@ int main(int argc, char* argv[]) { } else r = list_homes(); - finish: return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } diff --git a/src/resolve/resolvconf-compat.c b/src/resolve/resolvconf-compat.c index 7f486107019..1342e7b1f4d 100644 --- a/src/resolve/resolvconf-compat.c +++ b/src/resolve/resolvconf-compat.c @@ -130,7 +130,6 @@ int resolvconf_parse_argv(int argc, char *argv[]) { {} }; - enum { TYPE_REGULAR, TYPE_PRIVATE, /* -p: Not supported, treated identically to TYPE_REGULAR */ diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 2ac3ef2bd2f..4d5682ec7ea 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -1232,7 +1232,6 @@ ssize_t dns_resource_record_payload(DnsResourceRecord *rr, void **out) { *out = rr->tlsa.data; return rr->tlsa.data_size; - case DNS_TYPE_OPENPGPKEY: default: *out = rr->generic.data; diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index 914bd39e0a7..b0fe3497da6 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -678,7 +678,6 @@ static int dns_transaction_dnssec_ready(DnsTransaction *t) { dns_transaction_complete(t, DNS_TRANSACTION_DNSSEC_FAILED); return 0; - default: log_debug("Auxiliary DNSSEC RR query failed with %s", dns_transaction_state_to_string(dt->state)); goto fail; @@ -1225,7 +1224,6 @@ static usec_t transaction_get_resend_timeout(DnsTransaction *t) { assert(t); assert(t->scope); - switch (t->scope->protocol) { case DNS_PROTOCOL_DNS: diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 216140b2481..49cee2939e4 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -1098,7 +1098,6 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con } else d = s; - r = sd_bus_message_append(m, "(ssbt)", s, d, ignore_enoent, flags); if (r < 0) return bus_log_create_error(r); diff --git a/src/shared/fdset.c b/src/shared/fdset.c index e9802bb82ca..e97a52619dd 100644 --- a/src/shared/fdset.c +++ b/src/shared/fdset.c @@ -206,7 +206,6 @@ int fdset_new_listen_fds(FDSet **_s, bool unset) { *_s = s; return 0; - fail: if (s) set_free(MAKE_SET(s)); diff --git a/src/shared/firewall-util.c b/src/shared/firewall-util.c index e0520e37cb2..a87151d90dd 100644 --- a/src/shared/firewall-util.c +++ b/src/shared/firewall-util.c @@ -168,7 +168,6 @@ int fw_add_local_dnat( uint16_t remote_port, const union in_addr_union *previous_remote) { - _cleanup_(iptc_freep) struct xtc_handle *h = NULL; struct ipt_entry *entry, *mask; struct ipt_entry_target *t; diff --git a/src/shared/import-util.c b/src/shared/import-util.c index ba30d62dcad..933229387e3 100644 --- a/src/shared/import-util.c +++ b/src/shared/import-util.c @@ -42,7 +42,6 @@ int import_url_last_component(const char *url, char **ret) { return 0; } - int import_url_change_last_component(const char *url, const char *suffix, char **ret) { const char *e; char *s; diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 0bbb7430958..26a1513a052 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -52,7 +52,6 @@ static int print_catalog(FILE *f, sd_journal *j) { int r; _cleanup_free_ char *t = NULL, *z = NULL; - r = sd_journal_get_catalog(j, &t); if (r < 0) return r; @@ -84,7 +83,6 @@ static int parse_field(const void *data, size_t length, const char *field, size_ nl = length - field_len; - buf = newdup_suffix0(char, (const char*) data + field_len, nl); if (!buf) return log_oom(); diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c index 314488ab8f2..5ecc23f6e57 100644 --- a/src/shared/utmp-wtmp.c +++ b/src/shared/utmp-wtmp.c @@ -275,7 +275,6 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) { return write_utmp_wtmp(&store, &store_wtmp); } - int utmp_put_runlevel(int runlevel, int previous) { struct utmpx store = {}; int r; diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index b3c05464616..94971ea045d 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -1478,7 +1478,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { } } - switch (action[0]) { case ADD_RANGE: diff --git a/src/test/test-exec-util.c b/src/test/test-exec-util.c index dcddbfd9886..c5166c6954a 100644 --- a/src/test/test-exec-util.c +++ b/src/test/test-exec-util.c @@ -236,7 +236,6 @@ const gather_stdout_callback_t gather_stdout[] = { gather_stdout_three, }; - static void test_stdout_gathering(void) { char template[] = "/tmp/test-exec-util.XXXXXXX"; const char *dirs[] = {template, NULL}; diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c index 443afd8a86b..ba22e865fd7 100644 --- a/src/test/test-fileio.c +++ b/src/test/test-fileio.c @@ -561,7 +561,6 @@ static void test_search_and_fopen(void) { assert_se(r < 0); } - static void test_search_and_fopen_nulstr(void) { const char dirs[] = "/tmp/foo/bar\0/tmp\0"; char name[] = "/tmp/test-search_and_fopen.XXXXXX"; diff --git a/src/test/test-job-type.c b/src/test/test-job-type.c index 57025208dbb..fefeecb948c 100644 --- a/src/test/test-job-type.c +++ b/src/test/test-job-type.c @@ -83,6 +83,5 @@ int main(int argc, char*argv[]) { } } - return 0; } diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c index 8aa76e4d0a3..599219e326a 100644 --- a/src/test/test-libudev.c +++ b/src/test/test-libudev.c @@ -394,7 +394,6 @@ int main(int argc, char *argv[]) { assert_not_reached("Unhandled option code."); } - /* add sys path if needed */ if (!startswith(syspath, "/sys")) syspath = strjoina("/sys/", syspath); diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c index 5008630e018..d26e633466d 100644 --- a/src/test/test-locale-util.c +++ b/src/test/test-locale-util.c @@ -5,7 +5,6 @@ Copyright 2014 Ronny Chevalier ***/ - #include "locale-util.h" #include "macro.h" #include "strv.h" diff --git a/src/test/test-nss.c b/src/test/test-nss.c index 0b118b5b2cc..f6dee45ac07 100644 --- a/src/test/test-nss.c +++ b/src/test/test-nss.c @@ -181,7 +181,6 @@ static void test_gethostbyname4_r(void *handle, const char *module, const char * } } - static void test_gethostbyname3_r(void *handle, const char *module, const char *name, int af) { const char *fname; _nss_gethostbyname3_r_t f; @@ -401,7 +400,6 @@ static int test_one_module(const char* dir, char **name; int i; - log_info("======== %s ========", module); handle = open_handle(streq(module, "dns") ? NULL : dir, diff --git a/src/test/test-parse-util.c b/src/test/test-parse-util.c index 19273b2e257..37dbb0ce7a9 100644 --- a/src/test/test-parse-util.c +++ b/src/test/test-parse-util.c @@ -662,7 +662,6 @@ static void test_parse_nice(void) { assert_se(parse_nice("19", &n) >= 0 && n == 19); assert_se(parse_nice("+19", &n) >= 0 && n == 19); - assert_se(parse_nice("", &n) == -EINVAL); assert_se(parse_nice("-", &n) == -EINVAL); assert_se(parse_nice("+", &n) == -EINVAL); diff --git a/src/test/test-path.c b/src/test/test-path.c index 3d990407b38..ed53177dcc8 100644 --- a/src/test/test-path.c +++ b/src/test/test-path.c @@ -102,7 +102,6 @@ static void check_stop_unlink(Manager *m, Unit *unit, const char *test_path, con service_state_to_string(service->state), service_result_to_string(service->result)); - /* But we timeout if the service has not been started in the allocated time */ n = now(CLOCK_MONOTONIC); if (ts + timeout < n) { diff --git a/src/test/test-stat-util.c b/src/test/test-stat-util.c index 5fff7c93a0b..6c9c132612a 100644 --- a/src/test/test-stat-util.c +++ b/src/test/test-stat-util.c @@ -48,7 +48,6 @@ static void test_is_symlink(void) { assert_se(is_symlink(name_link) == 1); assert_se(is_symlink("/a/file/which/does/not/exist/i/guess") < 0); - unlink(name); unlink(name_link); } diff --git a/src/test/test-string-util.c b/src/test/test-string-util.c index a04c1f9d3ad..965e2c5028e 100644 --- a/src/test/test-string-util.c +++ b/src/test/test-string-util.c @@ -135,7 +135,6 @@ static void test_strrep(void) { assert_se(streq(zero, "")); } - static void test_strappend(void) { _cleanup_free_ char *t1, *t2, *t3, *t4; diff --git a/src/test/test-strv.c b/src/test/test-strv.c index fa658eb0566..ffe75073557 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -89,7 +89,6 @@ static const char* const input_table_one_empty[] = { NULL, }; - static void test_strv_find(void) { assert_se(strv_find((char **)input_table_multiple, "three")); assert_se(!strv_find((char **)input_table_multiple, "four")); diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c index 84b20267ad3..6b72fc90fd2 100644 --- a/src/test/test-unit-file.c +++ b/src/test/test-unit-file.c @@ -383,7 +383,6 @@ static void test_config_parse_exec(void) { c1 = c1->command_next; check_execcommand(c1, "/bin/grep", NULL, "\\w+\\K", NULL, false); - log_info("/* trailing backslash: \\ */"); /* backslash is invalid */ r = config_parse_exec(NULL, "fake", 4, "section", 1, diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c index 061adc70d8d..b45c1529157 100644 --- a/src/test/test-unit-name.c +++ b/src/test/test-unit-name.c @@ -412,7 +412,6 @@ static void test_unit_name_escape(void) { assert_se(streq(r, "ab\\x2b\\x2dc.a-bc\\x40foo.service")); } - static void test_u_n_t_one(const char *name, const char *expected, int ret) { _cleanup_free_ char *f = NULL; diff --git a/src/udev/mtd_probe/probe_smartmedia.c b/src/udev/mtd_probe/probe_smartmedia.c index 5d58de6a871..c058d83c2ed 100644 --- a/src/udev/mtd_probe/probe_smartmedia.c +++ b/src/udev/mtd_probe/probe_smartmedia.c @@ -35,7 +35,6 @@ static const uint8_t cis_signature[] = { 0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20 }; - void probe_smart_media(int mtd_fd, mtd_info_t* info) { int sector_size; int block_size; diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c index bf6b28e8e53..844805de122 100644 --- a/src/udev/scsi_id/scsi_serial.c +++ b/src/udev/scsi_id/scsi_serial.c @@ -603,7 +603,6 @@ static int check_fill_0x83_prespc3(struct udev *udev, return 0; } - /* Get device identification VPD page */ static int do_scsi_page83_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, int fd, diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 006cdd35012..c30e98dd985 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1740,8 +1740,6 @@ int main(int argc, char *argv[]) { log_warning_errno(r, "Failed to redirect standard streams to /dev/null: %m"); } - - pid = fork(); switch (pid) { case 0: diff --git a/tools/find-double-newline.sh b/tools/find-double-newline.sh new file mode 100755 index 00000000000..c41811483cb --- /dev/null +++ b/tools/find-double-newline.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# SPDX-License-Identifier: LGPL-2.1+ + +case "$1" in + + recdiff) + if [ "$2" = "" ] ; then + DIR="$PWD/.." + else + DIR="$2" + fi + + find $DIR -type f \( -name '*.c' -o -name '*.xml' \) -exec $0 diff \{\} \; + ;; + + recpatch) + if [ "$2" = "" ] ; then + DIR="$PWD/.." + else + DIR="$2" + fi + + find $DIR -type f \( -name '*.c' -o -name '*.xml' \) -exec $0 patch \{\} \; + ;; + + diff) + T=`mktemp` + sed '/^$/N;/^\n$/D' < "$2" > "$T" + diff -u "$2" "$T" + rm -f "$T" + ;; + + patch) + sed -i '/^$/N;/^\n$/D' "$2" + ;; + + *) + echo "Expected recdiff|recpatch|diff|patch as verb." >&2 + ;; +esac