From 4c66eb6d4cbdddc658e5f0274d8130155c6013f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Sat, 3 Oct 2020 21:20:43 +0200 Subject: 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 --- linux/Battery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/Battery.c') 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; -- cgit v1.2.3