diff --git a/src/dragonfly.cc b/src/dragonfly.cc index 7a2fb2d89..06fc207df 100644 --- a/src/dragonfly.cc +++ b/src/dragonfly.cc @@ -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; @@ -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); @@ -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; @@ -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 { @@ -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]; @@ -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"); @@ -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; } diff --git a/src/freebsd.cc b/src/freebsd.cc index 75c03d1d9..76490414b 100644 --- a/src/freebsd.cc +++ b/src/freebsd.cc @@ -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]; @@ -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; } diff --git a/src/haiku.cc b/src/haiku.cc index 62423f391..6138374ab 100644 --- a/src/haiku.cc +++ b/src/haiku.cc @@ -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 diff --git a/src/linux.cc b/src/linux.cc index a9ebd22da..b10fd7ed1 100644 --- a/src/linux.cc +++ b/src/linux.cc @@ -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 diff --git a/src/netbsd.cc b/src/netbsd.cc index 514657806..4d59c9d43 100644 --- a/src/netbsd.cc +++ b/src/netbsd.cc @@ -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]; diff --git a/src/openbsd.cc b/src/openbsd.cc index 36568ebb6..870be3623 100644 --- a/src/openbsd.cc +++ b/src/openbsd.cc @@ -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() { diff --git a/src/solaris.cc b/src/solaris.cc index 2dbbdf64f..eee15160e 100644 --- a/src/solaris.cc +++ b/src/solaris.cc @@ -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;