summaryrefslogtreecommitdiffstats
path: root/linux/Battery.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-10-03 21:20:43 +0200
committerChristian Göttsche <cgzones@googlemail.com>2020-10-19 15:38:45 +0200
commit4c66eb6d4cbdddc658e5f0274d8130155c6013f1 (patch)
tree8446343e944911b68b590a4bb5f834476f13230b /linux/Battery.c
parent577416d1a946382ab9f0c523e5fae755f9d71f69 (diff)
XUtils string related updates
- allow count out-parameter of String_split() to be NULL - introduce xStrndup() - do not allow NULL pointers passed to String_eq() it is not used in any code - implement String_startsWith(), String_contains_i() and String_eq() as inline header functions - adjust several conversion issues
Diffstat (limited to 'linux/Battery.c')
-rw-r--r--linux/Battery.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/linux/Battery.c b/linux/Battery.c
index f3e2ff24..956a7397 100644
--- a/linux/Battery.c
+++ b/linux/Battery.c
@@ -53,7 +53,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
if (!dirEntry)
break;
char* entryName = dirEntry->d_name;
- if (strncmp(entryName, "BAT", 3))
+ if (String_startsWith(entryName, "BAT"))
continue;
batteries[nBatteries] = xStrdup(entryName);
nBatteries++;
@@ -128,7 +128,7 @@ static ACPresence procAcpiCheck(void) {
char *isOnline = String_getToken(line, 2);
free(line);
- if (strcmp(isOnline, "on-line") == 0) {
+ if (String_eq(isOnline, "on-line")) {
isOn = AC_PRESENT;
} else {
isOn = AC_ABSENT;