diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-04-19 12:13:23 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-04-19 12:13:23 +0200 |
commit | 5d13a15b1d0bd7d218100d204a84eaaaaeab932f (patch) | |
tree | 08d1ba916131ac128453713792cd8498b556de3a | |
parent | Merge pull request #8758 from keszybz/improved-slice-checks (diff) | |
download | systemd-5d13a15b1d0bd7d218100d204a84eaaaaeab932f.tar.xz systemd-5d13a15b1d0bd7d218100d204a84eaaaaeab932f.zip |
tree-wide: drop spurious newlines (#8764)
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.
91 files changed, 40 insertions, 121 deletions
diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml index 423bb3a12d..37cb2002d4 100644 --- a/man/file-hierarchy.xml +++ b/man/file-hierarchy.xml @@ -565,7 +565,6 @@ </variablelist> </refsect1> - <refsect1> <title>Unprivileged Write Access</title> diff --git a/man/journal-remote.conf.xml b/man/journal-remote.conf.xml index 24ade09023..db5e4efd5b 100644 --- a/man/journal-remote.conf.xml +++ b/man/journal-remote.conf.xml @@ -70,7 +70,6 @@ </para></listitem> </varlistentry> - <varlistentry> <term><varname>SplitMode=</varname></term> diff --git a/man/journald.conf.xml b/man/journald.conf.xml index 96422a3a2f..760d649a3d 100644 --- a/man/journald.conf.xml +++ b/man/journald.conf.xml @@ -276,7 +276,6 @@ seconds.</para></listitem> </varlistentry> - <varlistentry> <term><varname>SyncIntervalSec=</varname></term> diff --git a/man/sd-id128.xml b/man/sd-id128.xml index 124bb3384e..f7a147ab30 100644 --- a/man/sd-id128.xml +++ b/man/sd-id128.xml @@ -114,7 +114,6 @@ int main(int argc, char **argv) { } </programlisting> - <para><function>SD_ID128_CONST_STR()</function> 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 a5906fbfbb..63659f8cd1 100644 --- a/man/sd_get_seats.xml +++ b/man/sd_get_seats.xml @@ -106,7 +106,6 @@ errno-style error code.</para> </refsect1> - <refsect1> <title>Errors</title> diff --git a/man/sd_journal_get_catalog.xml b/man/sd_journal_get_catalog.xml index 6974c7437c..85aa189d4f 100644 --- a/man/sd_journal_get_catalog.xml +++ b/man/sd_journal_get_catalog.xml @@ -53,7 +53,6 @@ <paramdef>char **<parameter>ret</parameter></paramdef> </funcprototype> - </funcsynopsis> </refsynopsisdiv> diff --git a/man/systemd-journal-upload.xml b/man/systemd-journal-upload.xml index fc3ecd2fdc..900706a34d 100644 --- a/man/systemd-journal-upload.xml +++ b/man/systemd-journal-upload.xml @@ -147,7 +147,6 @@ </para></listitem> </varlistentry> - <varlistentry> <term><option>--save-state</option><optional>=<replaceable>PATH</replaceable></optional></term> diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 3c30f817c9..b2ac0a2655 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -353,7 +353,6 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting> </variablelist> </refsect1> - <refsect1> <title>Security</title> @@ -746,7 +745,6 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting> </variablelist> </refsect1> - <refsect1> <title>Sandboxing</title> @@ -2637,5 +2635,4 @@ StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy </para> </refsect1> - </refentry> diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 0da884591a..b71e197f11 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1369,7 +1369,6 @@ </variablelist> </refsect1> - <refsect1> <title>[DHCPServer] Section Options</title> <para>The <literal>[DHCPServer]</literal> section contains diff --git a/man/systemd.timer.xml b/man/systemd.timer.xml index 76a8dc4d8c..fea7f3ff72 100644 --- a/man/systemd.timer.xml +++ b/man/systemd.timer.xml @@ -263,7 +263,6 @@ suffix.</para></listitem> </varlistentry> - <varlistentry> <term><varname>Persistent=</varname></term> diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index f69264d637..179bb0f799 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 36873fd397..ae2c6238c4 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 b62f2bd877..13e357efd4 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 7c36d78cc6..a6efbc3a7b 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 5095cee91b..1623932f18 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 5e096b8f99..6598b1a812 100644 --- a/src/basic/ratelimit.c +++ b/src/basic/ratelimit.c @@ -5,7 +5,6 @@ Copyright 2010 Lennart Poettering ***/ - #include <sys/time.h> #include "macro.h" diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c index 6f370f9cba..aba3e4f15d 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 7766229822..95a79f7b53 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 5aaffe8fa5..ffdc4dcaf7 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 c2118b6296..fc384464d6 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 419d75f53e..f19edfd987 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 ad19d327d3..4a522c61ac 100644 --- a/src/core/audit-fd.c +++ b/src/core/audit-fd.c @@ -5,7 +5,6 @@ Copyright 2012 Lennart Poettering ***/ - #include <errno.h> #include "audit-fd.h" diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 1308bc195c..426732483e 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 09dc93e53b..e36a050bdd 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 4e751478b1..89bc5c0a1b 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 6ded96571a..be44166ce3 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 ae956fa2fc..4581dd520e 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 6906858918..29db2ae7e3 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 0a56f0df86..9e54614cde 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 61e752ad3e..c0b1fbe525 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 930b3f406b..70e78237b5 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 870194a46b..017162f2fb 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 01e7cc9683..09574da5ce 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 113ee59bd9..4103e0eed6 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 f847a7314b..c73390cfdf 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 27544c8ae5..7399d3315f 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 86d541a17c..995083655a 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 6df87560fb..5194b3136f 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 17fa48fe5b..9cb7dfc920 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 9578ffffe5..9c13d7b46d 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 db816aa6ab..c09dbb1778 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 948bdd1cb2..907f32bf8d 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 13af80bcb4..391fc417eb 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 ec725ce46c..ec241d2f36 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; i<HASHSTATE; ++i) state[i] = 1; printf("These should all be different\n"); @@ -999,7 +992,6 @@ void driver5() printf("hash is %.8lx\n", c); /* cd628161 */ } - int main() { driver1(); /* test that the key is hashed: used for timings */ diff --git a/src/libsystemd-network/lldp-neighbor.c b/src/libsystemd-network/lldp-neighbor.c index bba2e047da..4aee537fd5 100644 --- a/src/libsystemd-network/lldp-neighbor.c +++ b/src/libsystemd-network/lldp-neighbor.c @@ -328,7 +328,6 @@ int lldp_neighbor_parse(sd_lldp_neighbor *n) { break; } - p += length, left -= length; } diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 148281c59d..78ef1eb3cf 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -379,7 +379,6 @@ int config_parse_bridge_port_priority( return 0; } - void serialize_in_addrs(FILE *f, const struct in_addr *addresses, size_t size) { unsigned i; diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index fc3a70d07d..f139484a86 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test-dhcp6-client.c @@ -571,7 +571,6 @@ static int test_client_verify_request(DHCP6Message *request, size_t len) { assert_se(!found_iana); found_iana = true; - assert_se(optlen == 40); assert_se(!memcmp(optval, &test_iaid, sizeof(test_iaid))); diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c index 303d111159..b28041ecc3 100644 --- a/src/libsystemd/sd-bus/bus-creds.c +++ b/src/libsystemd/sd-bus/bus-creds.c @@ -116,7 +116,6 @@ _public_ sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c) { sd_bus_message_unref(m); } - return NULL; } @@ -209,7 +208,6 @@ _public_ int sd_bus_creds_get_suid(sd_bus_creds *c, uid_t *suid) { return 0; } - _public_ int sd_bus_creds_get_fsuid(sd_bus_creds *c, uid_t *fsuid) { assert_return(c, -EINVAL); assert_return(fsuid, -EINVAL); diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index 3f214dcfe1..7a5da73def 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -894,7 +894,6 @@ int bus_match_parse( components[n_components].value_u8 = u; n_components++; - if (q[quoted] == 0) break; diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 0be4e23e50..19683eef82 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -3221,7 +3221,6 @@ end: return 0; } - static int message_peek_body( sd_bus_message *m, size_t *rindex, @@ -5315,7 +5314,6 @@ int bus_message_parse_fields(sd_bus_message *m) { break; - case BUS_MESSAGE_HEADER_SIGNATURE: { const char *s; char *c; diff --git a/src/libsystemd/sd-bus/bus-signature.c b/src/libsystemd/sd-bus/bus-signature.c index ab9afdb499..662a1eac5f 100644 --- a/src/libsystemd/sd-bus/bus-signature.c +++ b/src/libsystemd/sd-bus/bus-signature.c @@ -96,7 +96,6 @@ static int signature_element_length_internal( return -EINVAL; } - int signature_element_length(const char *s, size_t *l) { return signature_element_length_internal(s, true, 0, 0, l); } diff --git a/src/libsystemd/sd-bus/bus-slot.c b/src/libsystemd/sd-bus/bus-slot.c index 06b9b0edb2..3745426c5c 100644 --- a/src/libsystemd/sd-bus/bus-slot.c +++ b/src/libsystemd/sd-bus/bus-slot.c @@ -157,7 +157,6 @@ void bus_slot_disconnect(sd_bus_slot *slot) { key.interface = slot->node_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 e5966cfe2e..0c38589c2d 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 6449d421b3..3b792dd5a7 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 dfbb76f61f..3ef611d165 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 84399bbe93..4559168d00 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 d9277501d2..eb131ae50c 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 b2909a76a2..d038e78d19 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 6a4390ea2d..26f58a52a6 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 150947c9e0..0303943981 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 a1c1c2a51f..c79f2d283d 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 c921f92d14..d2ec6ce9d6 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 7169c11576..a507c49b34 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 5275845750..ea6442991b 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 7f48610701..1342e7b1f4 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 2ac3ef2bd2..4d5682ec7e 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 914bd39e0a..b0fe3497da 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 216140b248..49cee2939e 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 e9802bb82c..e97a52619d 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 e0520e37cb..a87151d90d 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 ba30d62dca..933229387e 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 0bbb743095..26a1513a05 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 314488ab8f..5ecc23f6e5 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 b3c0546461..94971ea045 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 dcddbfd988..c5166c6954 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 443afd8a86..ba22e865fd 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 57025208db..fefeecb948 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 8aa76e4d0a..599219e326 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 5008630e01..d26e633466 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 0b118b5b2c..f6dee45ac0 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 19273b2e25..37dbb0ce7a 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 3d990407b3..ed53177dcc 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 5fff7c93a0..6c9c132612 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 a04c1f9d3a..965e2c5028 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 fa658eb056..ffe7507355 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 84b20267ad..6b72fc90fd 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 061adc70d8..b45c152915 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 5d58de6a87..c058d83c2e 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 bf6b28e8e5..844805de12 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 006cdd3501..c30e98dd98 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 0000000000..c41811483c --- /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 |