1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* encoding.c (rb_enc_associate_index): pass unnecessary enc_capable().

* string.c (rb_str_cmp): reduce invocation of rb_enc_compatible().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-03-15 09:19:38 +00:00
parent 8ead071828
commit 2694b2f937
4 changed files with 19 additions and 9 deletions

View file

@ -1,3 +1,9 @@
Sat Mar 15 17:48:48 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* encoding.c (rb_enc_associate_index): pass unnecessary enc_capable().
* string.c (rb_str_cmp): reduce invocation of rb_enc_compatible().
Fri Mar 14 17:04:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/ruby.h (inttypes.h): includes always if available.

View file

@ -615,7 +615,7 @@ void
rb_enc_associate_index(VALUE obj, int idx)
{
enc_check_capable(obj);
if (rb_enc_get_index(obj) == idx)
if (rb_enc_internal_get_index(obj) == idx)
return;
if (!ENC_CODERANGE_ASCIIONLY(obj) ||
!rb_enc_asciicompat(rb_enc_from_index(idx))) {

View file

@ -253,13 +253,19 @@ rb_str_coderange_scan_restartable(const char *s, const char *e, rb_encoding *enc
}
}
static inline void
str_enc_copy(VALUE str1, VALUE str2)
{
rb_enc_internal_set_index(str1, ENCODING_GET(str2));
}
static void
rb_enc_cr_str_copy_for_substr(VALUE dest, VALUE src)
{
/* this function is designed for copying encoding and coderange
* from src to new string "dest" which is made from the part of src.
*/
rb_enc_copy(dest, src);
str_enc_copy(dest, src);
switch (ENC_CODERANGE(src)) {
case ENC_CODERANGE_7BIT:
ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);
@ -285,7 +291,7 @@ rb_enc_cr_str_copy_for_substr(VALUE dest, VALUE src)
static void
rb_enc_cr_str_exact_copy(VALUE dest, VALUE src)
{
rb_enc_copy(dest, src);
str_enc_copy(dest, src);
ENC_CODERANGE_SET(dest, ENC_CODERANGE(src));
}
@ -1884,14 +1890,12 @@ rb_str_cmp(VALUE str1, VALUE str2)
{
long len;
int retval;
rb_encoding *enc;
enc = rb_enc_compatible(str1, str2);
len = lesser(RSTRING_LEN(str1), RSTRING_LEN(str2));
retval = memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len);
if (retval == 0) {
if (RSTRING_LEN(str1) == RSTRING_LEN(str2)) {
if (!enc) {
if (!rb_enc_compatible(str1, str2)) {
if (ENCODING_GET(str1) - ENCODING_GET(str2) > 0)
return 1;
return -1;

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2008-03-14"
#define RUBY_RELEASE_DATE "2008-03-15"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20080314
#define RUBY_RELEASE_CODE 20080315
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 3
#define RUBY_RELEASE_DAY 14
#define RUBY_RELEASE_DAY 15
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];