* string.c (rb_str_rindex): refactoring and avoid to call str_nth() if
  pos == 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e