From: Topi Miettinen Date: Sat, 5 Jan 2019 18:37:34 +0000 (+0200) Subject: Delete duplicate lines X-Git-Tag: v241-rc1~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ae3561a5a6c85b080808335f0dd8f137acd5ba8;p=thirdparty%2Fsystemd.git Delete duplicate lines Found by inspecting results of running this small program: int main(int argc, const char **argv) { for (int i = 1; i < argc; i++) { FILE *f; char line[1024], prev[1024], *r; int lineno; prev[0] = '\0'; lineno = 1; f = fopen(argv[i], "r"); if (!f) exit(1); do { r = fgets(line, sizeof(line), f); if (!r) break; if (strcmp(line, prev) == 0) printf("%s:%d: error: dup %s", argv[i], lineno, line); lineno++; strcpy(prev, line); } while (!feof(f)); fclose(f); } } --- diff --git a/src/analyze/analyze-security.c b/src/analyze/analyze-security.c index 1fc3c1e02f0..3c732b712db 100644 --- a/src/analyze/analyze-security.c +++ b/src/analyze/analyze-security.c @@ -1859,7 +1859,6 @@ static int acquire_security_info(sd_bus *bus, const char *name, struct security_ { "PrivateNetwork", "b", NULL, offsetof(struct security_info, private_network) }, { "PrivateTmp", "b", NULL, offsetof(struct security_info, private_tmp) }, { "PrivateUsers", "b", NULL, offsetof(struct security_info, private_users) }, - { "PrivateUsers", "b", NULL, offsetof(struct security_info, private_users) }, { "ProtectControlGroups", "b", NULL, offsetof(struct security_info, protect_control_groups) }, { "ProtectHome", "s", NULL, offsetof(struct security_info, protect_home) }, { "ProtectKernelModules", "b", NULL, offsetof(struct security_info, protect_kernel_modules) }, diff --git a/src/basic/hashmap.h b/src/basic/hashmap.h index 5bf807a76f5..e16a9f9e30c 100644 --- a/src/basic/hashmap.h +++ b/src/basic/hashmap.h @@ -326,7 +326,6 @@ static inline void *ordered_hashmap_first_key_and_value(OrderedHashmap *h, void return internal_hashmap_first_key_and_value(HASHMAP_BASE(h), false, ret); } - static inline void *hashmap_steal_first(Hashmap *h) { return internal_hashmap_first_key_and_value(HASHMAP_BASE(h), true, NULL); } diff --git a/src/core/bpf-devices.c b/src/core/bpf-devices.c index dade7f04906..81e91fcb362 100644 --- a/src/core/bpf-devices.c +++ b/src/core/bpf-devices.c @@ -202,7 +202,6 @@ int cgroup_apply_device_bpf(Unit *u, BPFProgram *prog, CGroupDevicePolicy policy if (r < 0) return log_error_errno(r, "Failed to determine cgroup path: %m"); - r = bpf_program_cgroup_attach(prog, BPF_CGROUP_DEVICE, path, BPF_F_ALLOW_MULTI); if (r < 0) return log_error_errno(r, "Attaching device control BPF program to cgroup %s failed: %m", path); diff --git a/src/journal/journald-wall.h b/src/journal/journald-wall.h index d081c8254cc..b73059af466 100644 --- a/src/journal/journald-wall.h +++ b/src/journal/journald-wall.h @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once - #include "journald-server.h" void server_forward_wall(Server *s, int priority, const char *identifier, const char *message, const struct ucred *ucred); diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index b5ff5b64f33..0f996283cdf 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -36,7 +36,6 @@ #include "process-util.h" #include "replace-var.h" #include "stat-util.h" -#include "stat-util.h" #include "stdio-util.h" #include "string-util.h" #include "strv.h" diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index 79b2ea8bf25..32c20b1e4af 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -34,7 +34,6 @@ static void ndisc_callback(sd_ndisc *ndisc, sd_ndisc_event event, sd_ndisc_route assert(ndisc); assert(event >= 0 && event < _SD_NDISC_EVENT_MAX); - if (!ndisc->callback) { log_ndisc("Received '%s' event.", ndisc_event_to_string(event)); return; diff --git a/src/libsystemd/sd-resolve/sd-resolve.c b/src/libsystemd/sd-resolve/sd-resolve.c index 21d783b8f00..36b9c8d0196 100644 --- a/src/libsystemd/sd-resolve/sd-resolve.c +++ b/src/libsystemd/sd-resolve/sd-resolve.c @@ -912,7 +912,6 @@ static int alloc_query(sd_resolve *resolve, bool floating, sd_resolve_query **_q return 0; } - int resolve_getaddrinfo_with_destroy_callback( sd_resolve *resolve, sd_resolve_query **ret_query, diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index ed6b9df72ba..f9df26d75e0 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -254,7 +254,6 @@ static int dhcp6_route_handler(sd_netlink *nl, sd_netlink_message *m, Link *link return 1; } - static int dhcp6_lease_pd_prefix_acquired(sd_dhcp6_client *client, Link *link) { int r; sd_dhcp6_lease *lease; diff --git a/src/systemd/sd-netlink.h b/src/systemd/sd-netlink.h index 30be5b113ca..a97a965ec40 100644 --- a/src/systemd/sd-netlink.h +++ b/src/systemd/sd-netlink.h @@ -200,7 +200,6 @@ int sd_netlink_slot_set_floating(sd_netlink_slot *slot, int b); int sd_netlink_slot_get_description(sd_netlink_slot *slot, const char **description); int sd_netlink_slot_set_description(sd_netlink_slot *slot, const char *description); - _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink, sd_netlink_unref); _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink_message, sd_netlink_message_unref); _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink_slot, sd_netlink_slot_unref); diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c index 6e9b94b9331..52217429b15 100644 --- a/src/test/test-hexdecoct.c +++ b/src/test/test-hexdecoct.c @@ -233,7 +233,6 @@ static void test_unbase32hexmem(void) { test_unbase32hexmem_one("CPNMUOG=", false, -EINVAL, NULL); test_unbase32hexmem_one("CPNMUOJ1E8======", false, -EINVAL, NULL); - test_unbase32hexmem_one("A", false, -EINVAL, NULL); test_unbase32hexmem_one("A", false, -EINVAL, NULL); test_unbase32hexmem_one("AAA", false, -EINVAL, NULL); test_unbase32hexmem_one("AAAAAA", false, -EINVAL, NULL); diff --git a/src/test/test-json.c b/src/test/test-json.c index cd6269f798f..9a9b01aa183 100644 --- a/src/test/test-json.c +++ b/src/test/test-json.c @@ -209,7 +209,6 @@ static void test_2(JsonVariant *v) { assert_se(p && json_variant_type(p) == JSON_VARIANT_REAL && fabsl(json_variant_real(p) - 1.27) < 0.001); } - static void test_zeroes(JsonVariant *v) { size_t i; diff --git a/src/test/test-mountpoint-util.c b/src/test/test-mountpoint-util.c index 6d8bee0d633..8e45c0b1a7a 100644 --- a/src/test/test-mountpoint-util.c +++ b/src/test/test-mountpoint-util.c @@ -8,7 +8,6 @@ #include "fileio.h" #include "hashmap.h" #include "log.h" -#include "log.h" #include "mountpoint-util.h" #include "path-util.h" #include "rm-rf.h" diff --git a/src/test/test-stat-util.c b/src/test/test-stat-util.c index d16fdd90d1b..0e2155e9113 100644 --- a/src/test/test-stat-util.c +++ b/src/test/test-stat-util.c @@ -56,7 +56,6 @@ static void test_path_is_fs_type(void) { } assert_se(path_is_fs_type("/proc", PROC_SUPER_MAGIC) > 0); assert_se(path_is_fs_type("/proc", BTRFS_SUPER_MAGIC) == 0); - assert_se(path_is_fs_type("/proc", BTRFS_SUPER_MAGIC) == 0); assert_se(path_is_fs_type("/i-dont-exist", BTRFS_SUPER_MAGIC) == -ENOENT); } diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c index 2ec2ade3f18..eb6041c152d 100644 --- a/src/test/test-time-util.c +++ b/src/test/test-time-util.c @@ -212,7 +212,6 @@ static void test_format_timespan(usec_t accuracy) { test_format_timespan_one(12345678, accuracy); test_format_timespan_one(1200000, accuracy); test_format_timespan_one(1230000, accuracy); - test_format_timespan_one(1230000, accuracy); test_format_timespan_one(1234000, accuracy); test_format_timespan_one(1234500, accuracy); test_format_timespan_one(1234560, accuracy); @@ -289,7 +288,6 @@ static void test_usec_sub_signed(void) { assert_se(usec_sub_signed(4, 4) == 0); assert_se(usec_sub_signed(4, 5) == 0); assert_se(usec_sub_signed(USEC_INFINITY-3, -3) == USEC_INFINITY); - assert_se(usec_sub_signed(USEC_INFINITY-3, -3) == USEC_INFINITY); assert_se(usec_sub_signed(USEC_INFINITY-3, -4) == USEC_INFINITY); assert_se(usec_sub_signed(USEC_INFINITY-3, -5) == USEC_INFINITY); assert_se(usec_sub_signed(USEC_INFINITY, 5) == USEC_INFINITY); diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c index 94f2740592d..7ce1c5644fd 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c @@ -110,7 +110,6 @@ static sd_device *handle_scsi_fibre_channel(sd_device *parent, char **path) { assert(parent); assert(path); - if (sd_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target", &targetdev) < 0) return NULL; if (sd_device_get_sysname(targetdev, &sysname) < 0) diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c index d141bc74b2a..140950df620 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -425,7 +425,6 @@ int info_main(int argc, char *argv[], void *userdata) { assert_not_reached("Unknown option"); } - if (action == ACTION_DEVICE_ID_FILE) { if (argv[optind]) return log_error_errno(SYNTHETIC_ERRNO(EINVAL),