diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-27 14:33:16 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-27 14:33:16 -0700 |
commit | 976fd73a773dcda341c5b64e4d194ca257f47393 (patch) | |
tree | a54cce2d4794f1b03475301e69e91ce1426451e6 | |
parent | 4c76c7c4b63ca7c47e9b19253f737b3548843cae (diff) | |
download | rpatricia-976fd73a773dcda341c5b64e4d194ca257f47393.tar.gz |
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
-rw-r--r-- | ext/rpatricia/rpatricia.c | 4 |
1 files 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; } |