summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-12-14 16:26:13 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-12-16 02:14:47 +0900
commit393fcaf733d8e50f18a70be7de1e088fb61f1ff4 (patch)
tree191ca1b192c59bdf15423f3844a3cedea8970afd /src/libudev
parent9a56b87717ae6c24576b939b6484f3af175514d6 (diff)
downloadsystemd-393fcaf733d8e50f18a70be7de1e088fb61f1ff4.tar.gz
udev: move util_replace_chars() to udev-util.c
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev-util.c43
-rw-r--r--src/libudev/libudev-util.h2
2 files changed, 0 insertions, 45 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index f4f686fc88..8a6b56be5c 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -75,49 +75,6 @@ int util_resolve_subsys_kernel(const char *string, char *result, size_t maxsize,
return 0;
}
-/* allow chars in allow list, plain ascii, hex-escaping and valid utf8 */
-size_t util_replace_chars(char *str, const char *allow) {
- size_t i = 0, replaced = 0;
-
- assert(str);
-
- while (str[i] != '\0') {
- int len;
-
- if (allow_listed_char_for_devnode(str[i], allow)) {
- i++;
- continue;
- }
-
- /* accept hex encoding */
- if (str[i] == '\\' && str[i+1] == 'x') {
- i += 2;
- continue;
- }
-
- /* accept valid utf8 */
- len = utf8_encoded_valid_unichar(str + i, (size_t) -1);
- if (len > 1) {
- i += len;
- continue;
- }
-
- /* if space is allowed, replace whitespace with ordinary space */
- if (isspace(str[i]) && allow && strchr(allow, ' ')) {
- str[i] = ' ';
- i++;
- replaced++;
- continue;
- }
-
- /* everything else is replaced with '_' */
- str[i] = '_';
- i++;
- replaced++;
- }
- return replaced;
-}
-
/**
* udev_util_encode_string:
* @str: input string to be encoded
diff --git a/src/libudev/libudev-util.h b/src/libudev/libudev-util.h
index dd0561d90e..547981311e 100644
--- a/src/libudev/libudev-util.h
+++ b/src/libudev/libudev-util.h
@@ -9,8 +9,6 @@
#define UTIL_PATH_SIZE 1024
#define UTIL_NAME_SIZE 512
#define UTIL_LINE_SIZE 16384
-#define UDEV_ALLOWED_CHARS_INPUT "/ $%?,"
-size_t util_replace_chars(char *str, const char *white);
int util_resolve_subsys_kernel(const char *string, char *result, size_t maxsize, bool read_value);
/* Cleanup functions */