summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2024-04-17 16:45:46 +0800
committerBenBE <BenBE@geshi.org>2024-04-17 11:54:00 +0200
commita46b3f0a98c801b94df08598be0127e4d7db2aca (patch)
tree9a0e51e445dbb19685897d225ff847016f9c6761 /generic
parent6f0adfab242f40e0a0e82445abac4e574c7a97e8 (diff)
Use 'fp' name for local 'FILE*' variables.
It is inappropriate to use the 'fd' name for 'FILE*' variables. POSIX file descriptiors are of type 'int' and are distinguished from ISO C stream pointers (type 'FILE*'). Rename these variables to 'fp', which is a preferred naming in POSIX. (Note that ISO C preferred the 'stream' name for the variables.) No code changes.
Diffstat (limited to 'generic')
-rw-r--r--generic/uname.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/uname.c b/generic/uname.c
index b5bb5834..d8293b3a 100644
--- a/generic/uname.c
+++ b/generic/uname.c
@@ -26,8 +26,8 @@ in the source distribution for its full text.
#endif
static void parseOSRelease(char* buffer, size_t bufferLen) {
- FILE* stream = fopen(OSRELEASEFILE, "r");
- if (!stream) {
+ FILE* fp = fopen(OSRELEASEFILE, "r");
+ if (!fp) {
xSnprintf(buffer, bufferLen, "No OS Release");
return;
}
@@ -35,14 +35,14 @@ static void parseOSRelease(char* buffer, size_t bufferLen) {
char name[64] = {'\0'};
char version[64] = {'\0'};
char lineBuffer[256];
- while (fgets(lineBuffer, sizeof(lineBuffer), stream)) {
+ while (fgets(lineBuffer, sizeof(lineBuffer), fp)) {
if (String_startsWith(lineBuffer, "PRETTY_NAME=\"")) {
const char* start = lineBuffer + strlen("PRETTY_NAME=\"");
const char* stop = strrchr(lineBuffer, '"');
if (!stop || stop <= start)
continue;
String_safeStrncpy(buffer, start, MINIMUM(bufferLen, (size_t)(stop - start + 1)));
- fclose(stream);
+ fclose(fp);
return;
}
if (String_startsWith(lineBuffer, "NAME=\"")) {
@@ -62,7 +62,7 @@ static void parseOSRelease(char* buffer, size_t bufferLen) {
continue;
}
}
- fclose(stream);
+ fclose(fp);
snprintf(buffer, bufferLen, "%s%s%s", name[0] ? name : "", name[0] && version[0] ? " " : "", version);
}

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