Index: common/stdc/uchar.c
===================================================================
--- common/stdc/uchar.c	(revision f94a11f41744187ab341186d49bcbcc8e6ad5718)
+++ common/stdc/uchar.c	(revision 65bf08437fcd848d357a9e3d4004b178ef9adafd)
@@ -59,131 +59,4 @@
 }
 
-static bool _is_continuation(uint8_t c)
-{
-	return (c & 0xC0) == 0x80;
-}
-
-static bool _is_1_byte(uint8_t c)
-{
-	return (c & 0x80) == 0;
-}
-
-static bool _is_2_byte(uint8_t c)
-{
-	return (c & 0xE0) == 0xC0;
-}
-
-static bool _is_3_byte(uint8_t c)
-{
-	return (c & 0xF0) == 0xE0;
-}
-
-static bool _is_4_byte(uint8_t c)
-{
-	return (c & 0xF8) == 0xF0;
-}
-
-static bool _is_non_shortest(unsigned short cont, uint8_t b)
-{
-	return (cont == 0b1111110000000000 && !(b & 0b00100000)) ||
-	    (cont == 0b1111111111110000 && !(b & 0b00110000));
-}
-
-size_t mbrtoc32(char32_t *c, const char *s, size_t n, mbstate_t *mb)
-{
-#if __STDC_HOSTED__
-	static fibril_local mbstate_t global_state = { };
-
-	if (!mb)
-		mb = &global_state;
-#else
-	assert(mb);
-#endif
-
-	if (n == 0)
-		return UCHAR_INCOMPLETE;
-
-	char32_t dummy;
-
-	if (!c)
-		c = &dummy;
-
-	if (!s) {
-		// Equivalent to mbrtoc32(NULL, "", 1, mb).
-		if (mb->state) {
-			_set_ilseq();
-			return UCHAR_ILSEQ;
-		} else {
-			return 0;
-		}
-	}
-
-	size_t i = 0;
-
-	if (!mb->state) {
-		/* Clean slate, read initial byte. */
-
-		uint8_t b = s[i++];
-
-		if (_is_1_byte(b)) {
-			*c = b;
-			return b == 0 ? 0 : 1;
-		}
-
-		if (_is_continuation(b)) {
-			/* unexpected continuation byte */
-			_set_ilseq();
-			return UCHAR_ILSEQ;
-		}
-
-		/*
-		 * The value stored into `continuation` is designed to have
-		 * just enough leading ones that after shifting in one less than
-		 * the expected number of continuation bytes, the most significant
-		 * bit becomes zero. (The field is 16b wide.)
-		 */
-
-		if (_is_2_byte(b)) {
-			/* Reject non-shortest form. */
-			if (!(b & 0b00011110)) {
-				_set_ilseq();
-				return UCHAR_ILSEQ;
-			}
-
-			/* 2 byte encoding               110xxxxx */
-			mb->state = b ^ 0b0000000011000000;
-
-		} else if (_is_3_byte(b)) {
-			/* 3 byte encoding               1110xxxx */
-			mb->state = b ^ 0b1111110011100000;
-
-		} else if (_is_4_byte(b)) {
-			/* 4 byte encoding               11110xxx */
-			mb->state = b ^ 0b1111111100000000;
-		}
-	}
-
-	for (; i < n; i++) {
-		/* Read continuation bytes. */
-		uint8_t b = s[i];
-
-		if (!_is_continuation(b) || _is_non_shortest(mb->state, b)) {
-			_set_ilseq();
-			return UCHAR_ILSEQ;
-		}
-
-		/* Top bit becomes zero just before the last byte is shifted in. */
-		if (!(mb->state & 0x8000)) {
-			*c = ((char32_t) mb->state) << 6 | (b & 0x3f);
-			mb->state = 0;
-			return ++i;
-		}
-
-		mb->state = mb->state << 6 | (b & 0x3f);
-	}
-
-	return UCHAR_INCOMPLETE;
-}
-
 #define UTF8_CONT(c, shift) (0x80 | (((c) >> (shift)) & 0x3F))
 
