summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-04 02:36:04 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-04 02:36:04 +0100
commit6ed62be0b15ac92d9687cff93c63d7b06d11b9f0 (patch)
treefe08e5972852f3d52796f9478811fc1d750df313 /src/shared
parent3c6d3052d3597100e9d531df03cb15e9988dc94d (diff)
utf8: minor simplifications
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/utf8.c8
-rw-r--r--src/shared/utf8.h9
2 files changed, 8 insertions, 9 deletions
diff --git a/src/shared/utf8.c b/src/shared/utf8.c
index 699682010e..4469a73751 100644
--- a/src/shared/utf8.c
+++ b/src/shared/utf8.c
@@ -142,19 +142,19 @@ int utf8_encoded_to_unichar(const char *str) {
}
bool utf8_is_printable_newline(const char* str, size_t length, bool newline) {
- const uint8_t *p;
+ const char *p;
assert(str);
- for (p = (const uint8_t*) str; length;) {
+ for (p = str; length;) {
int encoded_len, val;
- encoded_len = utf8_encoded_valid_unichar((const char *) p);
+ encoded_len = utf8_encoded_valid_unichar(p);
if (encoded_len < 0 ||
(size_t) encoded_len > length)
return false;
- val = utf8_encoded_to_unichar((const char*) p);
+ val = utf8_encoded_to_unichar(p);
if (val < 0 ||
is_unicode_control(val) ||
(!newline && val == '\n'))
diff --git a/src/shared/utf8.h b/src/shared/utf8.h
index 1fe1a350d5..59abee50ac 100644
--- a/src/shared/utf8.h
+++ b/src/shared/utf8.h
@@ -29,13 +29,12 @@
const char *utf8_is_valid(const char *s) _pure_;
char *ascii_is_valid(const char *s) _pure_;
-char *utf8_escape_invalid(const char *s);
-char *utf8_escape_non_printable(const char *str);
bool utf8_is_printable_newline(const char* str, size_t length, bool newline) _pure_;
-_pure_ static inline bool utf8_is_printable(const char* str, size_t length) {
- return utf8_is_printable_newline(str, length, true);
-}
+#define utf8_is_printable(str, length) utf8_is_printable_newline(str, length, true)
+
+char *utf8_escape_invalid(const char *s);
+char *utf8_escape_non_printable(const char *str);
char *utf16_to_utf8(const void *s, size_t length);