Permalink
Browse files

Add defines for ENCODING_GET and ENCODING_SET

This is a simple alias for rb_enc_get_index and rb_enc_set_index.
On MRI this does a bunch of nasty internal stuff with objects,
but the external behavior is the same as these functions.

Fixes #1564
  • Loading branch information...
1 parent a4a328a commit 46dae288621c634a0bec2a76a582f4c48407e018 @dbussink dbussink committed Feb 22, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 vm/capi/19/include/ruby/encoding.h
View
3 vm/capi/19/include/ruby/encoding.h
@@ -36,6 +36,9 @@ typedef OnigEncodingType rb_encoding;
#define rb_enc_mbminlen(enc) (enc)->min_enc_len
#define rb_enc_mbmaxlen(enc) (enc)->max_enc_len
+#define ENCODING_GET(obj) rb_enc_get_index(obj)
+#define ENCODING_SET(obj, i) rb_enc_set_index(obj, i)
+
int rb_encdb_alias(const char *alias, const char *orig);
int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc);

0 comments on commit 46dae28

Please sign in to comment.