diff options
author | iphydf <iphydf@users.noreply.github.com> | 2020-05-05 22:56:03 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2020-05-05 23:22:29 +0100 |
commit | 8c0fd40356e4a7724b556e17b15b0d14f7d25b4d (patch) | |
tree | 489599830b083d5705c0b5d2c8fb31a43242f90c /toxcore/network.c | |
parent | fd2bb77923b68ec50e4812c9663eab42314d4557 (diff) |
refactor: Remove multi-declarators entirely.
We no longer allow `int a, b;`. In the few cases where we used it, we
instead better
* limit the scope of the identifier (e.g. in a for-init-decl)
* split the line and have 2 separate declarators, because the
identifiers designate different types of things (e.g. friend numbers
and group numbers).
Diffstat (limited to 'toxcore/network.c')
-rw-r--r-- | toxcore/network.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/toxcore/network.c b/toxcore/network.c index e5a58331..c448cb7e 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -1532,7 +1532,8 @@ size_t net_unpack_u16(const uint8_t *bytes, uint16_t *v) | |||
1532 | size_t net_unpack_u32(const uint8_t *bytes, uint32_t *v) | 1532 | size_t net_unpack_u32(const uint8_t *bytes, uint32_t *v) |
1533 | { | 1533 | { |
1534 | const uint8_t *p = bytes; | 1534 | const uint8_t *p = bytes; |
1535 | uint16_t lo, hi; | 1535 | uint16_t hi; |
1536 | uint16_t lo; | ||
1536 | p += net_unpack_u16(p, &hi); | 1537 | p += net_unpack_u16(p, &hi); |
1537 | p += net_unpack_u16(p, &lo); | 1538 | p += net_unpack_u16(p, &lo); |
1538 | *v = ((uint32_t)hi << 16) | lo; | 1539 | *v = ((uint32_t)hi << 16) | lo; |
@@ -1542,7 +1543,8 @@ size_t net_unpack_u32(const uint8_t *bytes, uint32_t *v) | |||
1542 | size_t net_unpack_u64(const uint8_t *bytes, uint64_t *v) | 1543 | size_t net_unpack_u64(const uint8_t *bytes, uint64_t *v) |
1543 | { | 1544 | { |
1544 | const uint8_t *p = bytes; | 1545 | const uint8_t *p = bytes; |
1545 | uint32_t lo, hi; | 1546 | uint32_t hi; |
1547 | uint32_t lo; | ||
1546 | p += net_unpack_u32(p, &hi); | 1548 | p += net_unpack_u32(p, &hi); |
1547 | p += net_unpack_u32(p, &lo); | 1549 | p += net_unpack_u32(p, &lo); |
1548 | *v = ((uint64_t)hi << 32) | lo; | 1550 | *v = ((uint64_t)hi << 32) | lo; |