summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-02 08:22:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-02 08:22:43 +0000
commit14dfdb5eaf2f4004fa0b08b0a1888e40e1ba5bc4 (patch)
tree4beb8cf8aaf6a2f68d7eb2c5fac7889b1da8a50c
parent66564ab6b2d5a4d223573a13e39c9fdf21127cab (diff)
dir.c: use built-in encoding indexes
* internal.h: add UTF8-MAC. * dir.c (rb_utf8mac_encoding): use built-in encoding indexes in internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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