mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
cleanup: Addressing comments from #165
Thanks @rustyrussell for the feedback :-)
This commit is contained in:
@@ -838,13 +838,12 @@ static struct ipaddr *read_addresses(const tal_t *ctx, u8 *ser)
|
|||||||
struct ipaddr *ipaddrs = tal_arr(ctx, struct ipaddr, 0);
|
struct ipaddr *ipaddrs = tal_arr(ctx, struct ipaddr, 0);
|
||||||
int numaddrs = 0;
|
int numaddrs = 0;
|
||||||
while (cursor < ser + max) {
|
while (cursor < ser + max) {
|
||||||
numaddrs += 1;
|
numaddrs++;
|
||||||
tal_resize(&ipaddrs, numaddrs);
|
tal_resize(&ipaddrs, numaddrs);
|
||||||
fromwire_ipaddr(&cursor, &max, &ipaddrs[numaddrs-1]);
|
fromwire_ipaddr(&cursor, &max, &ipaddrs[numaddrs-1]);
|
||||||
if (cursor == NULL) {
|
if (cursor == NULL) {
|
||||||
/* Parsing address failed */
|
/* Parsing address failed */
|
||||||
tal_free(ipaddrs);
|
return tal_free(ipaddrs);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ipaddrs;
|
return ipaddrs;
|
||||||
|
|||||||
@@ -169,11 +169,11 @@ void fromwire_ipaddr(const u8 **cursor, size_t *max, struct ipaddr *addr)
|
|||||||
{
|
{
|
||||||
/* Skip any eventual padding */
|
/* Skip any eventual padding */
|
||||||
while (**cursor == 0) {
|
while (**cursor == 0) {
|
||||||
*cursor += 1;
|
(*cursor)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr->type = **cursor;
|
addr->type = **cursor;
|
||||||
*cursor += 1;
|
(*cursor)++;
|
||||||
switch (addr->type) {
|
switch (addr->type) {
|
||||||
case 1:
|
case 1:
|
||||||
addr->addrlen = 4;
|
addr->addrlen = 4;
|
||||||
|
|||||||
Reference in New Issue
Block a user