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);
	}
}
This commit is contained in:
Topi Miettinen 2019-01-05 20:37:34 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 899072c0cd
commit 7ae3561a5a
16 changed files with 0 additions and 17 deletions

View file

@ -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) },

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -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"

View file

@ -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;

View file

@ -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,

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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"

View file

@ -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);
}

View file

@ -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);

View file

@ -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)

View file

@ -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),