[macruby-changes] [3634] MacRuby/branches/icu
source_changes at macosforge.org
source_changes at macosforge.org
Fri Feb 26 15:39:59 PST 2010
Revision: 3634
http://trac.macosforge.org/projects/ruby/changeset/3634
Author: lsansonetti at apple.com
Date: 2010-02-26 15:39:57 -0800 (Fri, 26 Feb 2010)
Log Message:
-----------
make sure the parser does not emit binary strings as symbols + misc cleanup
Modified Paths:
--------------
MacRuby/branches/icu/include/ruby/ruby.h
MacRuby/branches/icu/parse.y
MacRuby/branches/icu/string.c
MacRuby/branches/icu/symbol.c
Modified: MacRuby/branches/icu/include/ruby/ruby.h
===================================================================
--- MacRuby/branches/icu/include/ruby/ruby.h 2010-02-26 11:11:53 UTC (rev 3633)
+++ MacRuby/branches/icu/include/ruby/ruby.h 2010-02-26 23:39:57 UTC (rev 3634)
@@ -909,7 +909,6 @@
VALUE rb_id2str(ID);
VALUE rb_name2sym(const char *);
const char *rb_sym2name(VALUE sym);
-VALUE rb_sym2str(VALUE sym);
static inline
const char *rb_id2name(ID val)
Modified: MacRuby/branches/icu/parse.y
===================================================================
--- MacRuby/branches/icu/parse.y 2010-02-26 11:11:53 UTC (rev 3633)
+++ MacRuby/branches/icu/parse.y 2010-02-26 23:39:57 UTC (rev 3634)
@@ -269,7 +269,7 @@
// TODO: we should probably mimic what 1.9 does here and use the right/given
// encoding instead of always UTF8.
# define UTF8_ENC() (NULL)
-#define __new_tmp_str(p, n) (rb_str_new(p, n))
+# define __new_tmp_str(p, n) (rb_str_new(p, n))
# define STR_NEW(p,n) __new_tmp_str(p, n)
# define STR_NEW0() __new_tmp_str(0, 0)
# define STR_NEW2(p) __new_tmp_str(p, strlen(p))
@@ -283,7 +283,7 @@
# define STR_NEW3(p,n,e,func) parser_str_new((p),(n),(e),(func),parser->enc)
#endif
#if WITH_OBJC
-# define STR_ENC(m) (parser->enc)
+# define STR_ENC(m) (NULL)
# define ENC_SINGLE(cr) (1)
#else
# define STR_ENC(m) ((m)?parser->enc:rb_usascii_encoding())
Modified: MacRuby/branches/icu/string.c
===================================================================
--- MacRuby/branches/icu/string.c 2010-02-26 11:11:53 UTC (rev 3633)
+++ MacRuby/branches/icu/string.c 2010-02-26 23:39:57 UTC (rev 3634)
@@ -203,7 +203,7 @@
NEWOBJ(str, rb_str_t);
str->basic.flags = 0;
str->basic.klass = klass;
- str->encoding = rb_encodings[ENCODING_BINARY];
+ str->encoding = rb_encodings[ENCODING_UTF8];
str->capacity_in_bytes = 0;
str->length_in_bytes = 0;
str->data.bytes = NULL;
@@ -1037,7 +1037,7 @@
{
switch (TYPE(str)) {
case T_SYMBOL:
- str = rb_sym2str(str);
+ str = rb_sym_to_s(str);
break;
case T_STRING:
Modified: MacRuby/branches/icu/symbol.c
===================================================================
--- MacRuby/branches/icu/symbol.c 2010-02-26 11:11:53 UTC (rev 3633)
+++ MacRuby/branches/icu/symbol.c 2010-02-26 23:39:57 UTC (rev 3634)
@@ -169,15 +169,9 @@
}
VALUE
-rb_sym2str(VALUE sym)
-{
- return (VALUE)RSYM(sym)->str;
-}
-
-VALUE
rb_sym_to_s(VALUE sym)
{
- return rb_str_dup(rb_sym2str(sym));
+ return rb_str_dup((VALUE)RSYM(sym)->str);
}
const char *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100226/dacd7884/attachment.html>
More information about the macruby-changes
mailing list