Skip to content

Commit

Permalink
Ensure variable name reflect actual functionality (bcast -> nwork).
Browse files Browse the repository at this point in the history
  • Loading branch information
allinurl committed Jun 1, 2018
1 parent c052d1e commit 4aceaa7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/gholder.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ add_host_to_holder (GRawDataItem item, GHolder * h, GRawDataType type, const GPa
int hits = 0;
unsigned i;

struct in6_addr addr6, mask6, bcast6;
struct in_addr addr4, mask4, bcast4;
struct in6_addr addr6, mask6, nwork6;
struct in_addr addr4, mask4, nwork4;

const char *m4 = "255.255.255.0";
const char *m6 = "ffff:ffff:ffff:ffff:0000:0000:0000:0000";
Expand All @@ -523,9 +523,9 @@ add_host_to_holder (GRawDataItem item, GHolder * h, GRawDataType type, const GPa
if (1 == inet_pton (AF_INET, data, &addr4)) {
if (1 == inet_pton (AF_INET, m4, &mask4)) {
memset (buf4, 0, sizeof *buf4);
bcast4.s_addr = addr4.s_addr & mask4.s_addr;
nwork4.s_addr = addr4.s_addr & mask4.s_addr;

if (inet_ntop (AF_INET, &bcast4, buf4, INET_ADDRSTRLEN) != NULL) {
if (inet_ntop (AF_INET, &nwork4, buf4, INET_ADDRSTRLEN) != NULL) {
set_host (item, h, panel, buf4, hits);
free (data);
}
Expand All @@ -534,10 +534,10 @@ add_host_to_holder (GRawDataItem item, GHolder * h, GRawDataType type, const GPa
if (1 == inet_pton (AF_INET6, m6, &mask6)) {
memset (buf6, 0, sizeof *buf6);
for (i = 0; i < 16; i++) {
bcast6.s6_addr[i] = addr6.s6_addr[i] & mask6.s6_addr[i];
nwork6.s6_addr[i] = addr6.s6_addr[i] & mask6.s6_addr[i];
}

if (inet_ntop (AF_INET6, &bcast6, buf6, INET6_ADDRSTRLEN) != NULL) {
if (inet_ntop (AF_INET6, &nwork6, buf6, INET6_ADDRSTRLEN) != NULL) {
set_host (item, h, panel, buf6, hits);
free (data);
}
Expand Down

0 comments on commit 4aceaa7

Please sign in to comment.