Remove unneded {}s

$ perl -i -0pe 's|\s+{\n([^\n]*;)\n\s+}\n|\n\1\n|gms' **/*.c

Inspired by ea7cbf5bdd.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-04-12 18:26:05 +02:00 committed by Lennart Poettering
parent 8cf85bb575
commit 38cd55b007
11 changed files with 14 additions and 28 deletions

View File

@ -302,9 +302,8 @@ EFI_STATUS tpm_log_event(UINT32 pcrindex, const EFI_PHYSICAL_ADDRESS buffer, UIN
EFI_TCG2 *tpm2;
tpm2 = tcg2_interface_check();
if (tpm2) {
if (tpm2)
return tpm2_measure_to_pcr_and_event_log(tpm2, pcrindex, buffer, buffer_size, description);
}
tpm1 = tcg1_interface_check();
if (tpm1)

View File

@ -336,9 +336,8 @@ static char* merge_unit_ids(const char* unit_log_field, char **pairs) {
STRV_FOREACH_PAIR(unit_id, job_type, pairs) {
next = strlen(unit_log_field) + strlen(*unit_id);
if (!GREEDY_REALLOC(ans, alloc, size + next + 1)) {
if (!GREEDY_REALLOC(ans, alloc, size + next + 1))
return mfree(ans);
}
sprintf(ans + size, "%s%s", unit_log_field, *unit_id);
if (*(unit_id+1))

View File

@ -535,9 +535,8 @@ static int inspect_home(int argc, char *argv[], void *userdata) {
}
r = bus_call_method(bus, &home_mgr, "GetUserRecordByName", &error, &reply, "s", *i);
} else {
} else
r = bus_call_method(bus, &home_mgr, "GetUserRecordByUID", &error, &reply, "u", (uint32_t) uid);
}
if (r < 0) {
log_error_errno(r, "Failed to inspect home: %s", bus_error_message(&error, r));

View File

@ -166,9 +166,8 @@ CurlGlue *curl_glue_unref(CurlGlue *g) {
if (g->curl)
curl_multi_cleanup(g->curl);
while ((io = hashmap_steal_first(g->ios))) {
while ((io = hashmap_steal_first(g->ios)))
sd_event_source_unref(io);
}
hashmap_free(g->ios);

View File

@ -116,9 +116,8 @@ static void test_catalog_import_merge(void) {
h = test_import(input, -1, 0);
assert_se(ordered_hashmap_size(h) == 1);
ORDERED_HASHMAP_FOREACH(payload, h, j) {
ORDERED_HASHMAP_FOREACH(payload, h, j)
assert_se(streq(combined, payload));
}
}
static void test_catalog_import_merge_no_body(void) {
@ -149,9 +148,8 @@ static void test_catalog_import_merge_no_body(void) {
h = test_import(input, -1, 0);
assert_se(ordered_hashmap_size(h) == 1);
ORDERED_HASHMAP_FOREACH(payload, h, j) {
ORDERED_HASHMAP_FOREACH(payload, h, j)
assert_se(streq(combined, payload));
}
}
static void test_catalog_update(const char *database) {

View File

@ -267,9 +267,8 @@ int x11_read_data(Context *c, sd_bus_message *m) {
else if (streq(a[1], "XkbOptions"))
p = &c->x11_options;
if (p) {
if (p)
free_and_replace(*p, a[2]);
}
}
} else if (!in_section && first_word(l, "Section")) {

View File

@ -408,9 +408,8 @@ static void test_strv_split_newlines(void) {
l = strv_split_newlines(str);
assert_se(l);
STRV_FOREACH(s, l) {
STRV_FOREACH(s, l)
assert_se(streq(*s, input_table_multiple[i++]));
}
}
static void test_strv_split_nulstr(void) {

View File

@ -514,9 +514,8 @@ int main(int argc, char *argv[]) {
printf("ID_TYPE=generic\n");
break;
}
} else {
} else
printf("ID_TYPE=disk\n");
}
printf("ID_BUS=ata\n");
printf("ID_MODEL=%s\n", model);
printf("ID_MODEL_ENC=%s\n", model_enc);
@ -524,9 +523,8 @@ int main(int argc, char *argv[]) {
if (serial[0] != '\0') {
printf("ID_SERIAL=%s_%s\n", model, serial);
printf("ID_SERIAL_SHORT=%s\n", serial);
} else {
} else
printf("ID_SERIAL=%s\n", model);
}
if (id.command_set_1 & (1<<5)) {
printf("ID_ATA_WRITE_CACHE=1\n");

View File

@ -111,9 +111,8 @@ static char *get_value(char **buffer) {
*/
(*buffer)++;
end = quote_string;
} else {
} else
end = comma_string;
}
val = strsep(buffer, end);
if (val && end == quote_string)
/*

View File

@ -228,9 +228,8 @@ static bool test_pointers(sd_device *dev,
is_touchscreen = true;
else if (has_joystick_axes_or_buttons)
is_joystick = true;
} else if (has_joystick_axes_or_buttons) {
} else if (has_joystick_axes_or_buttons)
is_joystick = true;
}
if (has_mt_coordinates) {
if (stylus_or_pen)

View File

@ -125,9 +125,8 @@ static int on_reboot(Context *c) {
#if HAVE_AUDIT
if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
errno != EPERM)
r = log_error_errno(errno, "Failed to send audit message: %m");
}
#endif
/* If this call fails it will return 0, which
@ -154,9 +153,8 @@ static int on_shutdown(Context *c) {
#if HAVE_AUDIT
if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
errno != EPERM)
r = log_error_errno(errno, "Failed to send audit message: %m");
}
#endif
q = utmp_put_shutdown();