From 976fd73a773dcda341c5b64e4d194ca257f47393 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 27 Jul 2010 14:33:16 -0700 Subject: use rb_str_dup on strings instead of rb_obj_dup rb_str_dup should be slightly faster as the call stack is shallower and does not need additional method lookups --- ext/rpatricia/rpatricia.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/rpatricia/rpatricia.c b/ext/rpatricia/rpatricia.c index 854c5cd..828aebd 100644 --- a/ext/rpatricia/rpatricia.c +++ b/ext/rpatricia/rpatricia.c @@ -51,7 +51,7 @@ p_add (int argc, VALUE *argv, VALUE self) /* for backwards compatibility, we always dup and return new strings */ if (TYPE(user_data) == T_STRING) - user_data = rb_obj_dup(user_data); + user_data = rb_str_dup(user_data); } else { user_data = rb_str_new(NULL, 0); } @@ -159,7 +159,7 @@ p_data (VALUE self) /* for backwards compatibility, we always dup and return new strings */ if (TYPE(user_data) == T_STRING) - user_data = rb_obj_dup(user_data); + user_data = rb_str_dup(user_data); return user_data; } -- cgit v1.2.3-24-ge0c7