diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/utf8.c | 21 | ||||
-rw-r--r-- | src/shared/utf8.h | 2 | ||||
-rw-r--r-- | src/test/test-utf8.c | 17 |
3 files changed, 0 insertions, 40 deletions
diff --git a/src/shared/utf8.c b/src/shared/utf8.c index 98b68ef657..aedf6e29ea 100644 --- a/src/shared/utf8.c +++ b/src/shared/utf8.c @@ -184,27 +184,6 @@ char *ascii_is_valid(const char *str) { return (char*) str; } -char *ascii_filter(const char *str) { - const char *s; - char *r, *d; - size_t l; - - assert(str); - - l = strlen(str); - r = malloc(l + 1); - if (!r) - return NULL; - - for (s = str, d = r; *s; s++) - if ((unsigned char) *s < 128) - *(d++) = *s; - - *d = 0; - - return r; -} - char *utf16_to_utf8(const void *s, size_t length) { char *r; const uint8_t *f; diff --git a/src/shared/utf8.h b/src/shared/utf8.h index e3eef11bb9..f56077438a 100644 --- a/src/shared/utf8.h +++ b/src/shared/utf8.h @@ -30,8 +30,6 @@ char *ascii_is_valid(const char *s) _pure_; bool utf8_is_printable(const char* str, size_t length) _pure_; -char *ascii_filter(const char *s); - char *utf16_to_utf8(const void *s, size_t length); int utf8_encoded_valid_unichar(const char *str); diff --git a/src/test/test-utf8.c b/src/test/test-utf8.c index f0182ee9af..d2198fdc74 100644 --- a/src/test/test-utf8.c +++ b/src/test/test-utf8.c @@ -41,22 +41,6 @@ static void test_ascii_is_valid(void) { assert_se(!ascii_is_valid("\341\204")); } -static void test_ascii_filter(void) { - char *f; - - f = ascii_filter("alsdjf\t\vbarr\nba z"); - assert_se(streq(f, "alsdjf\t\vbarr\nba z")); - free(f); - - f = ascii_filter("\342\204\242"); - assert_se(streq(f, "")); - free(f); - - f = ascii_filter("foo\341\204bar"); - assert_se(streq(f, "foobar")); - free(f); -} - static void test_utf8_encoded_valid_unichar(void) { assert_se(utf8_encoded_valid_unichar("\342\204\242") == 3); assert_se(utf8_encoded_valid_unichar("\302\256") == 2); @@ -70,7 +54,6 @@ int main(int argc, char *argv[]) { test_utf8_is_valid(); test_utf8_is_printable(); test_ascii_is_valid(); - test_ascii_filter(); test_utf8_encoded_valid_unichar(); return 0; |