aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTechnorama team <oss-ruby@technorama.net>2004-02-18 22:25:32 +0000
committerTechnorama team <oss-ruby@technorama.net>2004-02-18 22:25:32 +0000
commit121484748f0edc41e642f9e1b5457e0634a76a92 (patch)
tree67bcab9ffad2e2296701f459a8fb5d1f3535f2ce
parente891a72aab9d956b111a18bedb5b1da217430341 (diff)
downloadruby-openssl-history-121484748f0edc41e642f9e1b5457e0634a76a92.tar.gz
add clone wrapper for ruby1.6
-rw-r--r--ruby_missing.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/ruby_missing.h b/ruby_missing.h
index bdb152b..272c208 100644
--- a/ruby_missing.h
+++ b/ruby_missing.h
@@ -56,14 +56,35 @@
rb_define_singleton_method(klass, "new", func##_wrapper, -1)
#endif
+/* the following clone wrapper is incomplete */
#if RUBY_VERSION_CODE >= 180
-# if !defined(HAVE_RB_OBJ_INIT_COPY)
+#define DEFINE_CLONE_WRAPPER(klass, func)
+#define rb_define_clone_func(klass, func)
+#else
+#define DEFINE_CLONE_WRAPPER(func) \
+ static VALUE ossl_##func##_clone_wrapper(VALUE self) { \
+ VALUE obj; \
+ \
+ obj = ossl_##func##_alloc(CLASS_OF(self)); \
+ ossl_##func##_copy(obj, self); \
+ \
+ return obj; \
+ }
+#define rb_define_clone_func(klass, func) \
+ rb_define_method(klass, "clone", func##_wrapper, 0)
+#endif
+
+
+#if RUBY_VERSION_CODE >= 180
+#if !defined(HAVE_RB_OBJ_INIT_COPY)
# define rb_define_copy_func(klass, func) \
rb_define_method(klass, "copy_object", func, 1)
# else
# define rb_define_copy_func(klass, func) \
rb_define_method(klass, "initialize_copy", func, 1)
# endif
+#else
+# define rb_define_copy_func(klass, func)
#endif
#endif /* _OSS_RUBY_MISSING_H_ */