summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2016-01-27 00:03:52 +0000
committerkrw <krw@openbsd.org>2016-01-27 00:03:52 +0000
commitbd45c0ec5e01d313dab22026a4dc14e09b3ca53b (patch)
tree0ea5bccf18a346c296d2ae6f9b5cc9ff7854f36b
parentRework and simplify string argument parsing. All string arguments are at (diff)
downloadwireguard-openbsd-bd45c0ec5e01d313dab22026a4dc14e09b3ca53b.tar.xz
wireguard-openbsd-bd45c0ec5e01d313dab22026a4dc14e09b3ca53b.zip
Nuke another (and I hope final) batch of superfluous '{}' around single
statements.
-rw-r--r--sbin/pdisk/dump.c40
-rw-r--r--sbin/pdisk/io.c14
-rw-r--r--sbin/pdisk/partition_map.c8
3 files changed, 24 insertions, 38 deletions
diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c
index 4a1d1e02d56..6cea590dad7 100644
--- a/sbin/pdisk/dump.c
+++ b/sbin/pdisk/dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.c,v 1.56 2016/01/26 21:07:54 krw Exp $ */
+/* $OpenBSD: dump.c,v 1.57 2016/01/27 00:03:52 krw Exp $ */
/*
* dump.c - dumping partition maps
@@ -144,18 +144,16 @@ dump_partition_entry(struct partition_map *entry, int type_length,
printf("%*u ", digits, p->dpme_pblocks);
size = p->dpme_pblocks;
}
- if (p->dpme_lblock_start == 0) {
+ if (p->dpme_lblock_start == 0)
printf("@ %-*u", digits, p->dpme_pblock_start);
- } else {
+ else
printf("@~%-*u", digits, p->dpme_pblock_start +
p->dpme_lblock_start);
- }
bytes = ((double) size) * map->logical_block;
adjust_value_and_compute_prefix(&bytes, &j);
- if (j != ' ' && j != 'K') {
+ if (j != ' ' && j != 'K')
printf(" (%#5.1f%c)", bytes, j);
- }
printf("\n");
}
@@ -283,9 +281,8 @@ full_dump_partition_entry(struct partition_map_header *map, int ix)
printf("pic ");
t = p->dpme_flags >> 7;
for (i = 7; i <= 31; i++) {
- if (t & 0x1) {
+ if (t & 0x1)
printf("%d ", i);
- }
t = t >> 1;
}
printf("\n");
@@ -320,32 +317,27 @@ dump_block(unsigned char *addr, int len)
for (i = 0; i < len; i = limit) {
limit1 = i + LINE_LEN;
- if (limit1 > len) {
+ if (limit1 > len)
limit = len;
- } else {
+ else
limit = limit1;
- }
printf("\n%03x: ", i);
for (j = i; j < limit1; j++) {
- if (j % UNIT_LEN == 0) {
+ if (j % UNIT_LEN == 0)
printf(" ");
- }
- if (j < limit) {
+ if (j < limit)
printf("%02x", addr[j]);
- } else {
+ else
printf(" ");
- }
}
printf(" ");
for (j = i; j < limit; j++) {
- if (j % OTHER_LEN == 0) {
+ if (j % OTHER_LEN == 0)
printf(" ");
- }
- if (addr[j] < ' ') {
+ if (addr[j] < ' ')
printf(".");
- } else {
+ else
printf("%c", addr[j]);
- }
}
}
printf("\n");
@@ -394,9 +386,8 @@ get_max_type_string_length(struct partition_map_header *map)
for (entry = map->disk_order; entry != NULL;
entry = entry->next_on_disk) {
length = strnlen(entry->dpme->dpme_type, DPISTRLEN);
- if (length > max) {
+ if (length > max)
max = length;
- }
}
return max;
@@ -413,9 +404,8 @@ get_max_name_string_length(struct partition_map_header *map)
for (entry = map->disk_order; entry != NULL;
entry = entry->next_on_disk) {
length = strnlen(entry->dpme->dpme_name, DPISTRLEN);
- if (length > max) {
+ if (length > max)
max = length;
- }
}
return max;
diff --git a/sbin/pdisk/io.c b/sbin/pdisk/io.c
index ef130c3ebc1..55dd9995277 100644
--- a/sbin/pdisk/io.c
+++ b/sbin/pdisk/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.24 2016/01/26 23:41:48 krw Exp $ */
+/* $OpenBSD: io.c,v 1.25 2016/01/27 00:03:52 krw Exp $ */
/*
* io.c - simple io and input parsing routines
@@ -197,18 +197,16 @@ get_number(int first_char)
}
ret_value = 0;
for (ret_value = 0;; c = my_getch()) {
- if (c >= '0' && c <= '9') {
+ if (c >= '0' && c <= '9')
digit = c - '0';
- } else if (c >= 'A' && c <= 'F') {
+ else if (c >= 'A' && c <= 'F')
digit = 10 + (c - 'A');
- } else if (c >= 'a' && c <= 'f') {
+ else if (c >= 'a' && c <= 'f')
digit = 10 + (c - 'a');
- } else {
+ else
digit = BAD_DIGIT;
- }
- if (digit >= base) {
+ if (digit >= base)
break;
- }
ret_value = ret_value * base + digit;
}
my_ungetch(c);
diff --git a/sbin/pdisk/partition_map.c b/sbin/pdisk/partition_map.c
index 6308843b30c..820ca9960b4 100644
--- a/sbin/pdisk/partition_map.c
+++ b/sbin/pdisk/partition_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: partition_map.c,v 1.68 2016/01/26 21:07:54 krw Exp $ */
+/* $OpenBSD: partition_map.c,v 1.69 2016/01/27 00:03:52 krw Exp $ */
/*
* partition_map.c - partition map routines
@@ -232,9 +232,8 @@ add_data_to_map(struct dpme *dpme, long ix, struct partition_map_header *map)
map->blocks_in_map++;
if (map->maximum_in_map < 0) {
- if (strncasecmp(dpme->dpme_type, kMapType, DPISTRLEN) == 0) {
+ if (strncasecmp(dpme->dpme_type, kMapType, DPISTRLEN) == 0)
map->maximum_in_map = dpme->dpme_pblocks;
- }
}
return 1;
}
@@ -378,9 +377,8 @@ add_partition_to_map(const char *name, const char *dptype, uint32_t base,
if (dpme != NULL) {
if (add_data_to_map(dpme,
cur->disk_address, map) ==
- 0) {
+ 0)
free(dpme);
- }
}
}
}