]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi: return pointer to processed string in strtolower8()/strtolower16()
authorLennart Poettering <lennart@poettering.net>
Thu, 4 Jul 2024 15:13:02 +0000 (17:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 2 Sep 2024 12:20:49 +0000 (14:20 +0200)
src/boot/efi/efi-string.c
src/boot/efi/efi-string.h

index 87beb8528607ccdd1081fa9f69cb13051cc7661d..aee98a81e1a17b5d3b28460b6c33790a1a0fd209 100644 (file)
@@ -41,12 +41,13 @@ DEFINE_STRNLEN(char16_t, strnlen16);
                 (_c >= 'A' && _c <= 'Z') ? _c + ('a' - 'A') : _c; \
         })
 
-#define DEFINE_STRTOLOWER(type, name)     \
-        void name(type *s) {              \
-                if (!s)                   \
-                        return;           \
-                for (; *s; s++)           \
-                        *s = TOLOWER(*s); \
+#define DEFINE_STRTOLOWER(type, name)                \
+        type* name(type *s) {                        \
+                if (!s)                              \
+                        return NULL;                 \
+                for (type *p = s; *p; p++)           \
+                        *p = TOLOWER(*p);            \
+                return s;                            \
         }
 
 DEFINE_STRTOLOWER(char, strtolower8);
index c7c49a07aa328d63b9de4871d1f31d23427187b0..9a0f89d904c6754545c3fbd0bdc1fe04ec07ab1e 100644 (file)
@@ -23,8 +23,8 @@ static inline size_t strsize16(const char16_t *s) {
         return s ? (strlen16(s) + 1) * sizeof(*s) : 0;
 }
 
-void strtolower8(char *s);
-void strtolower16(char16_t *s);
+char* strtolower8(char *s);
+char16_t* strtolower16(char16_t *s);
 
 int strncmp8(const char *s1, const char *s2, size_t n);
 int strncmp16(const char16_t *s1, const char16_t *s2, size_t n);