Permalink
Browse files

Add rb_str_equal

  • Loading branch information...
1 parent e518867 commit dc177cb64da21b311330c3b46a309244da4bfebf @dbussink dbussink committed Sep 28, 2012
Showing with 13 additions and 0 deletions.
  1. +2 −0 vm/capi/19/include/ruby/ruby.h
  2. +11 −0 vm/capi/string.cpp
@@ -1765,6 +1765,8 @@ VALUE rb_uint2big(unsigned long number);
long rb_str_hash(VALUE str);
+ VALUE rb_str_equal(VALUE self, VALUE other);
+
VALUE rb_str_length(VALUE self);
/** Raises an exception from the value of errno. */
View
@@ -487,4 +487,15 @@ extern "C" {
return string->hash_string(env->state());
}
+
+ VALUE rb_str_equal(VALUE self, VALUE other) {
+ if(self == other) {
+ return Qtrue;
+ }
+ NativeMethodEnvironment* env = NativeMethodEnvironment::get();
+ String* string = capi_get_string(env, self);
+ String* other_str = capi_get_string(env, other);
+
+ return env->get_handle(string->equal(env->state(), other_str));
+ }
}

0 comments on commit dc177cb

Please sign in to comment.