summaryrefslogtreecommitdiff
path: root/src/runtime/c/gu/utf8.c
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-09-04 10:27:08 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-09-04 10:27:08 +0000
commit93cbfd31d14be8b35e65eb7116fafcd0f867a72d (patch)
tree4d65209cf27dade4911c360968732f882f2070e3 /src/runtime/c/gu/utf8.c
parent805f95eac61ef17d7ec3f87dda1dfbc932951dee (diff)
remove the dependency on the CHAR_ASCII flag
Diffstat (limited to 'src/runtime/c/gu/utf8.c')
-rw-r--r--src/runtime/c/gu/utf8.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/runtime/c/gu/utf8.c b/src/runtime/c/gu/utf8.c
index fb0f2c150..0c24ef20e 100644
--- a/src/runtime/c/gu/utf8.c
+++ b/src/runtime/c/gu/utf8.c
@@ -1,6 +1,5 @@
#include <gu/assert.h>
#include <gu/utf8.h>
-#include "config.h"
GuUCS
gu_utf8_decode(const uint8_t** src_inout)
@@ -107,13 +106,11 @@ gu_in_utf8_char_(GuIn* in, GuExn* err)
char
gu_in_utf8_char(GuIn* in, GuExn* err)
{
-#ifdef CHAR_ASCII
int i = gu_in_peek_u8(in);
if (i >= 0 && i < 0x80) {
gu_in_consume(in, 1);
return (char) i;
}
-#endif
return gu_in_utf8_char_(in, err);
}
@@ -192,47 +189,11 @@ gu_utf32_out_utf8(const GuUCS* src, size_t len, GuOut* out, GuExn* err)
}
-#ifndef CHAR_ASCII
-
-void gu_str_out_utf8_(const char* str, GuOut* out, GuExn* err)
-{
- size_t len = strlen(str);
- size_t sz = 0;
- uint8_t* buf = gu_out_begin_span(out, len, &sz, err);
- if (!gu_ok(err)) {
- return;
- }
- if (buf != NULL && sz < len) {
- gu_out_end_span(out, 0);
- buf = NULL;
- }
- GuPool* tmp_pool = buf ? NULL : gu_local_pool();
- buf = buf ? buf : gu_new_n(uint8_t, len, tmp_pool);
- for (size_t i = 0; i < len; i++) {
- GuUCS ucs = gu_char_ucs(str[i]);
- buf[i] = (uint8_t) ucs;
- }
- if (tmp_pool) {
- gu_out_bytes(out, buf, len, err);
- gu_pool_free(tmp_pool);
- } else {
- gu_out_end_span(out, len);
- }
-}
-
-#endif
-
extern inline GuUCS
gu_in_utf8(GuIn* in, GuExn* err);
void
gu_str_out_utf8(const char* str, GuOut* out, GuExn* err)
{
-#ifdef CHAR_ASCII
gu_out_bytes(out, (const uint8_t*) str, strlen(str), err);
-#else
- extern void
- gu_str_out_utf8_(const char* str, GuOut* out, GuExn* err);
- gu_str_out_utf8_(str, out, err);
-#endif
}