#endif
- FILL_ARR(str1, "%"PRIuFAST16, packages);
+ FILL_ARR(str1, UFINT, packages);
}
bool found_fans = true;
char tempstr[VLA], buffer[VLA];
char *all_fans = buffer;
- uint_fast16_t x = 0, y = 0, z = 0, rpm[21];
+ uint8_t x = 0, y = 0, z = 0;
+ uint_fast16_t rpm[21];
#if defined(__linux__)
FILE *fp;
void
get_cpu(char *str1) {
static uintmax_t previous_total = 0, previous_idle = 0;
- uintmax_t x, percent, diff_total, diff_idle, cpu_active[LOOP_ITERZ];
- uintmax_t total = 0;
+ uintmax_t total = 0, percent = 0, diff_total = 0, diff_idle = 0;
+ uintmax_t cpu_active[LOOP_ITERZ];
+ uint8_t x = 0;
memset(cpu_active, 0, sizeof(cpu_active));
void
get_cores_load(char *str1) {
static uintmax_t previous_total[MAX_CORES], previous_idle[MAX_CORES];
- static uintmax_t test_flag = 0;
- uintmax_t x = 0, y = 0, z = 0;
+ static uint8_t test_flag = 0;
+ uint8_t x = 0, y = 0, z = 0;
uintmax_t percent[MAX_CORES], diff_total[MAX_CORES], core_active[MAX_CORES][LOOP_ITERZ];
uintmax_t diff_idle[MAX_CORES], total[MAX_CORES];
char buf[VLA], temp[VLA];
exit_with_err(ERR, "reached /proc/stat EOF");
}
- for (x = 0; x < MAX_CORES; x++) {
+ for (x = 0; x < MAX_CORES; x++, z++) {
if (NULL == fgets(buf, VLA, fp)) {
fclose(fp);
exit_with_err(ERR, "reached /proc/stat EOF");
}
fclose(fp);
- z = x;
for (x = 0; x < z; x++) {
#else /* FreeBSD */
GLUE2(all, FMT_UINT"%% ", percent[x]);
}
-
test_flag = 1;
FILL_STR_ARR(1, str1, temp);
struct statinfo stats;
struct device_selection *dev_select = NULL;
struct devstat *d = NULL;
- long select_generation = 0;
+ long int select_generation = 0;
int x = 0, num_devices = 0, num_selected = 0, num_selections = 0;
FILL_STR_ARR(1, str1, "Null");
get_voltage(char *str1) {
float voltage[4];
FILE *fp;
- uint_fast16_t x = 0;
+ uint8_t x = 0;
const char *voltage_files[] = {
VOLTAGE_FILE("0"),
get_ip_lookup(char *str1, char *str2) {
#if WITH_NET == 1
- struct addrinfo *rp = NULL, *result = NULL;
- struct addrinfo hints;
+ struct addrinfo *rp = NULL, *result = NULL, hints;
void *temp_void = NULL;
char temp[VLA];
- int err = 0;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0;
hints.ai_protocol = 0; /* udp | tcp */
- err = getaddrinfo(str2, NULL, &hints, &result);
- if (0 != err) {
+ if (0 != (getaddrinfo(str2, NULL, &hints, &result))) {
FUNC_FAILED("getaddrinfo()");
}
}
snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", str2);
- if (0 < (ioctl(sock, SIOCETHTOOL, &ifr))) {
+ if (0 != (ioctl(sock, SIOCETHTOOL, &ifr))) {
return;
}
struct rt_msghdr *rtm = NULL;
struct sockaddr *sa = NULL, *addrs[RTAX_MAX];
- char *buf = NULL, *next = NULL, *lim = NULL;
- char temp[VLA];
+ char *buf = NULL, *next = NULL, *lim = NULL, temp[VLA];
uint8_t x = 0;
size_t needed;
void *temp_void = NULL;
- FILL_STR_ARR(1, str1, "Null");
-
/* No, it's not Men In Black acronym */
int mib[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_DUMP, 0 };
if (0 != (sysctl(mib, 6, NULL, &needed, NULL, 0))) {
snd_mixer_t *handle = NULL;
snd_mixer_elem_t *elem = NULL;
snd_mixer_selem_id_t *s_elem = NULL;
- long int vol, max, min, percent;
+ long int vol = 0L, max = 0L, min = 0L, percent = 0L;
if (0 != (snd_mixer_open(&handle, 0))) {
FUNC_FAILED("alsa");
#if defined (HAVE_MPD_CLIENT_H)
struct mpd_connection *conn = NULL;
- struct mpd_song *song;
+ struct mpd_song *song = NULL;
if (NULL == (conn = mpd_connection_new(NULL, 0, 0))) {
return;