Debian Codegraph @

ext/-test-/string/enc_str_buf_cat.c

raw
1 #include "ruby/ruby.h"
2 #include "ruby/encoding.h"
3
4 static VALUE
5 enc_str_buf_cat(VALUE str, VALUE str2)
6 {
7 return rb_enc_str_buf_cat(str, RSTRING_PTR(str2), RSTRING_LEN(str2), rb_enc_get(str2));
8 }
9
10 static VALUE
11 str_conv_enc_opts(VALUE str, VALUE from, VALUE to, VALUE ecflags, VALUE ecopts)
12 {
13 rb_encoding *from_enc = NIL_P(from) ? NULL : rb_to_encoding(from);
14 rb_encoding *to_enc = NIL_P(to) ? NULL : rb_to_encoding(to);
15 int flags = NUM2INT(ecflags);
16 if (!NIL_P(ecopts)) {
17 Check_Type(ecopts, T_HASH);
18 OBJ_FREEZE(ecopts);
19 }
20 return rb_str_conv_enc_opts(str, from_enc, to_enc, flags, ecopts);
21 }
22
23 void
24 Init_string_enc_str_buf_cat(VALUE klass)
25 {
26 rb_define_method(klass, "enc_str_buf_cat", enc_str_buf_cat, 1);
27 rb_define_method(klass, "str_conv_enc_opts", str_conv_enc_opts, 4);
28 }