summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--dir.c4
-rw-r--r--encoding.c1
-rw-r--r--internal.h1
4 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0877505..76f36d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-Tue Jul 2 17:22:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jul 2 17:22:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h: add UTF8-MAC.
+
+ * dir.c (rb_utf8mac_encoding): use built-in encoding indexes in
+ internal.h.
* internal.h: add UTF-{16,32} dummy encodings.
diff --git a/dir.c b/dir.c
index 4781175..8a172d7 100644
--- a/dir.c
+++ b/dir.c
@@ -91,9 +91,7 @@ char *strchr(char*,char);
rb_encoding *
rb_utf8mac_encoding(void)
{
- static rb_encoding *utf8mac;
- if (!utf8mac) utf8mac = rb_enc_find("UTF8-MAC");
- return utf8mac;
+ return rb_enc_from_index(ENCINDEX_UTF8_MAC);
}
static inline int
diff --git a/encoding.c b/encoding.c
index d3f485e..5c399b1 100644
--- a/encoding.c
+++ b/encoding.c
@@ -565,6 +565,7 @@ rb_enc_init(void)
ENCDB_REGISTER("UTF-32LE", UTF_32LE);
ENCDB_REGISTER("UTF-16", UTF_16);
ENCDB_REGISTER("UTF-32", UTF_32);
+ ENCDB_REGISTER("UTF8-MAC", UTF8_MAC);
#undef ENCDB_REGISTER
#endif
enc_table.count = ENCINDEX_BUILTIN_MAX;
diff --git a/internal.h b/internal.h
index 6b76538..25e8220 100644
--- a/internal.h
+++ b/internal.h
@@ -210,6 +210,7 @@ enum ruby_preserved_encindex {
ENCINDEX_UTF_32LE,
ENCINDEX_UTF_16,
ENCINDEX_UTF_32,
+ ENCINDEX_UTF8_MAC,
#endif
ENCINDEX_BUILTIN_MAX