summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-07 12:41:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-07 12:41:02 +0000
commita08b001100734a3db4efbe9d38d3226950a538e0 (patch)
tree365b7af5aaa31ce9415c7df99f23854a3ab85314 /ext
parent07b72b8c856353096fad39a7f628e9076533dc18 (diff)
* bignum.c (rb_integer_pack): Renamed from rb_int_export.
(rb_integer_unpack): Renamed from rb_int_import. * internal.h, pack.c: Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/-test-/bignum/depend3
-rw-r--r--ext/-test-/bignum/export.c29
-rw-r--r--ext/-test-/bignum/import.c18
-rw-r--r--ext/-test-/bignum/pack.c40
4 files changed, 41 insertions, 49 deletions
diff --git a/ext/-test-/bignum/depend b/ext/-test-/bignum/depend
index 217aed9dac..8524e41ce6 100644
--- a/ext/-test-/bignum/depend
+++ b/ext/-test-/bignum/depend
@@ -1,4 +1,3 @@
$(OBJS): $(HDRS) $(ruby_headers)
-export.o: export.c $(top_srcdir)/internal.h
-import.o: import.c $(top_srcdir)/internal.h
+pack.o: pack.c $(top_srcdir)/internal.h
diff --git a/ext/-test-/bignum/export.c b/ext/-test-/bignum/export.c
deleted file mode 100644
index 56e4f9f6dc..0000000000
--- a/ext/-test-/bignum/export.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "ruby.h"
-#include "internal.h"
-
-static VALUE
-rb_int_export_m(VALUE val, VALUE buf, VALUE wordorder, VALUE wordsize_arg, VALUE endian, VALUE nails)
-{
- int sign;
- size_t count = 0;
- void *ret;
- size_t wordsize = NUM2SIZET(wordsize_arg);
-
- if (!NIL_P(buf)) {
- StringValue(buf);
- rb_str_modify(buf);
- count = RSTRING_LEN(buf) / wordsize;
- }
-
- ret = rb_int_export(val,
- &sign, &count, NIL_P(buf) ? NULL : RSTRING_PTR(buf), count,
- NUM2INT(wordorder), wordsize, NUM2INT(endian), NUM2INT(nails));
-
- return rb_ary_new_from_args(3, INT2NUM(sign), ret ? rb_str_new(ret, wordsize * count) : Qnil, SIZET2NUM(count));
-}
-
-void
-Init_export(VALUE klass)
-{
- rb_define_method(rb_cInteger, "test_export", rb_int_export_m, 5);
-}
diff --git a/ext/-test-/bignum/import.c b/ext/-test-/bignum/import.c
deleted file mode 100644
index c50d855c44..0000000000
--- a/ext/-test-/bignum/import.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "ruby.h"
-#include "internal.h"
-
-static VALUE
-rb_int_import_m(VALUE klass, VALUE sign, VALUE buf, VALUE wordcount, VALUE wordorder, VALUE wordsize, VALUE endian, VALUE nails)
-{
- StringValue(buf);
-
- return rb_int_import(NUM2INT(sign), RSTRING_PTR(buf),
- NUM2SIZET(wordcount), NUM2INT(wordorder), NUM2SIZET(wordsize),
- NUM2INT(endian), NUM2SIZET(nails));
-}
-
-void
-Init_import(VALUE klass)
-{
- rb_define_singleton_method(rb_cInteger, "test_import", rb_int_import_m, 7);
-}
diff --git a/ext/-test-/bignum/pack.c b/ext/-test-/bignum/pack.c
new file mode 100644
index 0000000000..5307db6f4b
--- /dev/null
+++ b/ext/-test-/bignum/pack.c
@@ -0,0 +1,40 @@
+#include "ruby.h"
+#include "internal.h"
+
+static VALUE
+rb_integer_pack_m(VALUE val, VALUE buf, VALUE wordorder, VALUE wordsize_arg, VALUE endian, VALUE nails)
+{
+ int sign;
+ size_t count = 0;
+ void *ret;
+ size_t wordsize = NUM2SIZET(wordsize_arg);
+
+ if (!NIL_P(buf)) {
+ StringValue(buf);
+ rb_str_modify(buf);
+ count = RSTRING_LEN(buf) / wordsize;
+ }
+
+ ret = rb_integer_pack(val,
+ &sign, &count, NIL_P(buf) ? NULL : RSTRING_PTR(buf), count,
+ NUM2INT(wordorder), wordsize, NUM2INT(endian), NUM2INT(nails));
+
+ return rb_ary_new_from_args(3, INT2NUM(sign), ret ? rb_str_new(ret, wordsize * count) : Qnil, SIZET2NUM(count));
+}
+
+static VALUE
+rb_integer_unpack_m(VALUE klass, VALUE sign, VALUE buf, VALUE wordcount, VALUE wordorder, VALUE wordsize, VALUE endian, VALUE nails)
+{
+ StringValue(buf);
+
+ return rb_integer_unpack(NUM2INT(sign), RSTRING_PTR(buf),
+ NUM2SIZET(wordcount), NUM2INT(wordorder), NUM2SIZET(wordsize),
+ NUM2INT(endian), NUM2SIZET(nails));
+}
+
+void
+Init_pack(VALUE klass)
+{
+ rb_define_method(rb_cInteger, "test_pack", rb_integer_pack_m, 5);
+ rb_define_singleton_method(rb_cInteger, "test_unpack", rb_integer_unpack_m, 7);
+}