ruby-changes:4292
From: ko1@a...
Date: Sat, 15 Mar 2008 18:19:57 +0900 (JST)
Subject: [ruby-changes:4292] matz - Ruby:r15782 (trunk): * encoding.c (rb_enc_associate_index): pass unnecessary enc_capable().
matz 2008-03-15 18:19:38 +0900 (Sat, 15 Mar 2008)
New Revision: 15782
Modified files:
trunk/ChangeLog
trunk/encoding.c
trunk/string.c
trunk/version.h
Log:
* encoding.c (rb_enc_associate_index): pass unnecessary enc_capable().
* string.c (rb_str_cmp): reduce invocation of rb_enc_compatible().
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=15782&r2=15781&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=15782&r2=15781&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15782&r2=15781&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/encoding.c?r1=15782&r2=15781&diff_format=u
Index: encoding.c
===================================================================
--- encoding.c (revision 15781)
+++ encoding.c (revision 15782)
@@ -615,7 +615,7 @@
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))) {
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15781)
+++ ChangeLog (revision 15782)
@@ -1,3 +1,9 @@
+Sat Mar 15 17:48:48 2008 Yukihiro Matsumoto <matz@r...>
+
+ * 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@r...>
* include/ruby/ruby.h (inttypes.h): includes always if available.
Index: string.c
===================================================================
--- string.c (revision 15781)
+++ string.c (revision 15782)
@@ -253,13 +253,19 @@
}
}
+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 @@
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 @@
{
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;
Index: version.h
===================================================================
--- version.h (revision 15781)
+++ version.h (revision 15782)
@@ -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[];
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/