summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-08-25 12:01:54 +0200
committerChristian Göttsche <cgzones@googlemail.com>2020-08-25 12:01:56 +0200
commit4e2b9f09654ff31602eaa294e0ac77b2f82ea3a9 (patch)
treedc6552093dc7262cbaddc4cd2cf5fe684a807df2 /linux
parentb4ceb83d760e7f58eed7d6785c81bece01c29662 (diff)
Avoid shadowing warnings
Diffstat (limited to 'linux')
-rw-r--r--linux/Battery.c26
-rw-r--r--linux/LinuxProcessList.c6
-rw-r--r--linux/Platform.c8
3 files changed, 20 insertions, 20 deletions
diff --git a/linux/Battery.c b/linux/Battery.c
index 7a1c8163..4014a500 100644
--- a/linux/Battery.c
+++ b/linux/Battery.c
@@ -64,7 +64,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
}
char* line = NULL;
- for (unsigned short int i = 0; i < lineNum; i++) {
+ for (unsigned short int j = 0; j < lineNum; j++) {
free(line);
line = String_readLine(file);
if (!line) break;
@@ -194,26 +194,26 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
const char filePath[50];
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName);
- int fd = open(filePath, O_RDONLY);
- if (fd == -1)
+ int fd1 = open(filePath, O_RDONLY);
+ if (fd1 == -1)
continue;
char type[8];
- ssize_t typelen = xread(fd, type, 7);
- close(fd);
+ ssize_t typelen = xread(fd1, type, 7);
+ close(fd1);
if (typelen < 1)
continue;
if (type[0] == 'B' && type[1] == 'a' && type[2] == 't') {
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/uevent", entryName);
- int fd = open(filePath, O_RDONLY);
- if (fd == -1) {
+ int fd2 = open(filePath, O_RDONLY);
+ if (fd2 == -1) {
closedir(dir);
return;
}
char buffer[1024];
- ssize_t buflen = xread(fd, buffer, 1023);
- close(fd);
+ ssize_t buflen = xread(fd2, buffer, 1023);
+ close(fd2);
if (buflen < 1) {
closedir(dir);
return;
@@ -259,18 +259,18 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
}
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/online", entryName);
- int fd = open(filePath, O_RDONLY);
- if (fd == -1) {
+ int fd3 = open(filePath, O_RDONLY);
+ if (fd3 == -1) {
closedir(dir);
return;
}
char buffer[2] = "";
for(;;) {
- ssize_t res = read(fd, buffer, 1);
+ ssize_t res = read(fd3, buffer, 1);
if (res == -1 && errno == EINTR) continue;
break;
}
- close(fd);
+ close(fd3);
if (buffer[0] == '0') {
*isOnAC = AC_ABSENT;
} else if (buffer[0] == '1') {
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 0d25e365..6d3d0348 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -1227,9 +1227,9 @@ static inline double LinuxProcessList_scanCPUFrequency(LinuxProcessList* this) {
(sscanf(buffer, "processor: %d", &cpuid) == 1)
) {
if (cpuid < 0 || cpuid > (cpus - 1)) {
- char buffer[64];
- xSnprintf(buffer, sizeof(buffer), PROCCPUINFOFILE " contains out-of-range CPU number %d", cpuid);
- CRT_fatalError(buffer);
+ char tmpbuffer[64];
+ xSnprintf(tmpbuffer, sizeof(tmpbuffer), PROCCPUINFOFILE " contains out-of-range CPU number %d", cpuid);
+ CRT_fatalError(tmpbuffer);
}
} else if (
(sscanf(buffer, "cpu MHz : %lf", &frequency) == 1) ||
diff --git a/linux/Platform.c b/linux/Platform.c
index 10311a2d..0f59fed6 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -94,12 +94,12 @@ static Htop_Reaction Platform_actionSetIOPriority(State* st) {
LinuxProcess* p = (LinuxProcess*) Panel_getSelected(panel);
if (!p) return HTOP_OK;
- IOPriority ioprio = p->ioPriority;
- Panel* ioprioPanel = IOPriorityPanel_new(ioprio);
+ IOPriority ioprio1 = p->ioPriority;
+ Panel* ioprioPanel = IOPriorityPanel_new(ioprio1);
void* set = Action_pickFromVector(st, ioprioPanel, 21, true);
if (set) {
- IOPriority ioprio = IOPriorityPanel_getIOPriority(ioprioPanel);
- bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) LinuxProcess_setIOPriority, (Arg){ .i = ioprio }, NULL);
+ IOPriority ioprio2 = IOPriorityPanel_getIOPriority(ioprioPanel);
+ bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) LinuxProcess_setIOPriority, (Arg){ .i = ioprio2 }, NULL);
if (!ok)
beep();
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy