History

lib/string_helpers: Introduce string_upper() and string_lower() helpers

Provide the helpers for string conversions to upper and lower cases.

Vadim Pasternak committed 6 years ago

Commit 58eeba01 parent 19206a11 file · +15 −0Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/string_helpers.h+15−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #ifndef _LINUX_STRING_HELPERS_H_
33 #define _LINUX_STRING_HELPERS_H_
44
5+#include <linux/ctype.h>
56 #include <linux/types.h>
67
78 struct file;
@@ -75,6 +76,20 @@ static inline int string_escape_str_any_np(const char *src, char *dst, · 67 unmodified lines
7576 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only);
7677 }
7778
79+static inline void string_upper(char *dst, const char *src)
80+{
81+ do {
82+ *dst++ = toupper(*src);
83+ } while (*src++);
84+}
85+
86+static inline void string_lower(char *dst, const char *src)
87+{
88+ do {
89+ *dst++ = tolower(*src);
90+ } while (*src++);
91+}
92+
7893 char *kstrdup_quotable(const char *src, gfp_t gfp);
7994 char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp);
8095 char *kstrdup_quotable_file(struct file *file, gfp_t gfp);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t