Skip to content

Commit

Permalink
Reformat, add empty comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
brndnmtthws committed Aug 7, 2018
1 parent 03abfc6 commit d9b218b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 37 deletions.
31 changes: 8 additions & 23 deletions src/dragonfly.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ int check_mount(char *s) {

mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
for (i = mntsize - 1; i >= 0; i--) {
if (strcmp(mntbuf[i].f_mntonname, s) == 0) {
return 1;
}
if (strcmp(mntbuf[i].f_mntonname, s) == 0) { return 1; }
}

return 0;
Expand Down Expand Up @@ -178,13 +176,9 @@ int update_net_stats(void) {

/* get delta */
delta = current_update_time - last_update_time;
if (delta <= 0.0001) {
return 0;
}
if (delta <= 0.0001) { return 0; }

if (getifaddrs(&ifap) < 0) {
return 0;
}
if (getifaddrs(&ifap) < 0) { return 0; }

for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
ns = get_net_stat((const char *)ifa->ifa_name, nullptr, NULL);
Expand All @@ -196,9 +190,7 @@ int update_net_stats(void) {
last_recv = ns->recv;
last_trans = ns->trans;

if (ifa->ifa_addr->sa_family != AF_LINK) {
continue;
}
if (ifa->ifa_addr->sa_family != AF_LINK) { continue; }

for (iftmp = ifa->ifa_next;
iftmp != nullptr && strcmp(ifa->ifa_name, iftmp->ifa_name) == 0;
Expand Down Expand Up @@ -286,9 +278,7 @@ void get_cpu_count(void) {
}

info.cpu_usage = (float *)malloc((info.cpu_count + 1) * sizeof(float));
if (info.cpu_usage == nullptr) {
CRIT_ERR(nullptr, NULL, "malloc");
}
if (info.cpu_usage == nullptr) { CRIT_ERR(nullptr, NULL, "malloc"); }
}

struct cpu_info {
Expand Down Expand Up @@ -357,8 +347,7 @@ int update_cpu_usage(void) {
return 0;
}

void free_cpu(struct text_object *) {
}
void free_cpu(struct text_object *) { /* no-op */ }

int update_load_average(void) {
double v[3];
Expand Down Expand Up @@ -492,9 +481,7 @@ void get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size,

(void)adapter; // only linux uses this

if (!p_client_buffer || client_buffer_size <= 0) {
return;
}
if (!p_client_buffer || client_buffer_size <= 0) { return; }

if (GETSYSCTL("hw.acpi.acline", state)) {
fprintf(stderr, "Cannot read sysctl \"hw.acpi.acline\"\n");
Expand Down Expand Up @@ -714,9 +701,7 @@ void get_top_info(void) {
#define APM_UNKNOWN 255

int apm_getinfo(int fd, apm_info_t aip) {
if (ioctl(fd, APMIO_GETINFO, aip) == -1) {
return -1;
}
if (ioctl(fd, APMIO_GETINFO, aip) == -1) { return -1; }

return 0;
}
Expand Down
7 changes: 2 additions & 5 deletions src/freebsd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ int update_cpu_usage(void) {
return 0;
}

void free_cpu(struct text_object *) {
}
void free_cpu(struct text_object *) { /* no-op */ }

int update_load_average(void) {
double v[3];
Expand Down Expand Up @@ -644,9 +643,7 @@ int update_diskio(void) {
free(dev_select);
}

if (statinfo_cur.dinfo->mem_ptr) {
free(statinfo_cur.dinfo->mem_ptr);
}
if (statinfo_cur.dinfo->mem_ptr) { free(statinfo_cur.dinfo->mem_ptr); }
free(statinfo_cur.dinfo);
return 0;
}
Expand Down
3 changes: 1 addition & 2 deletions src/haiku.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ int update_cpu_usage() {
return 1;
}

void free_cpu(struct text_object *) {
}
void free_cpu(struct text_object *) { /* no-op */ }

int update_load_average() {
// TODO
Expand Down
3 changes: 1 addition & 2 deletions src/linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,7 @@ int update_cpu_usage(void) {
return 0;
}

void free_cpu(struct text_object *) {
}
void free_cpu(struct text_object *) { /* no-op */ }

// fscanf() that reads floats with points even if you are using a locale where
// floats are with commas
Expand Down
3 changes: 1 addition & 2 deletions src/netbsd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ void update_cpu_usage() {
oldtotal = total;
}

void free_cpu(struct text_object *) {
}
void free_cpu(struct text_object *) { /* no-op */ }

void update_load_average() {
double v[3];
Expand Down
2 changes: 1 addition & 1 deletion src/openbsd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ void update_cpu_usage() {
#endif
}

void free_cpu(struct text_object *) {
void free_cpu(struct text_object *) { /* no-op */
}

void update_load_average() {
Expand Down
3 changes: 1 addition & 2 deletions src/solaris.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ int update_cpu_usage(void) {
return 0;
}

void free_cpu(struct text_object *) {
}
void free_cpu(struct text_object *) { /* no-op */ }

void update_proc_entry(struct process *p) {
psinfo_t proc;
Expand Down

0 comments on commit d9b218b

Please sign in to comment.