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
2#ifndef _LINUX_STRING_HELPERS_H_2#ifndef _LINUX_STRING_HELPERS_H_
3#define _LINUX_STRING_HELPERS_H_3#define _LINUX_STRING_HELPERS_H_
4 4
5#include <linux/ctype.h>
5#include <linux/types.h>6#include <linux/types.h>
6 7
7struct file;8struct file;
@@ -75,6 +76,20 @@ static inline int string_escape_str_any_np(const char *src, char *dst, · 67 unmodified lines
75 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only);76 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only);
76}77}
77 78
79static inline void string_upper(char *dst, const char *src)
80{
81 do {
82 *dst++ = toupper(*src);
83 } while (*src++);
84}
85
86static inline void string_lower(char *dst, const char *src)
87{
88 do {
89 *dst++ = tolower(*src);
90 } while (*src++);
91}
92
78char *kstrdup_quotable(const char *src, gfp_t gfp);93char *kstrdup_quotable(const char *src, gfp_t gfp);
79char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp);94char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp);
80char *kstrdup_quotable_file(struct file *file, gfp_t gfp);95char *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