[macruby-changes] [348] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 9 16:03:30 PDT 2008


Revision: 348
          http://trac.macosforge.org/projects/ruby/changeset/348
Author:   lsansonetti at apple.com
Date:     2008-07-09 16:03:30 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
RSTRING_PTR/RSTRING_LEN -> RSTRING_BYTEPTR/RSTRING_BYTELEN, RSTRING_CPTR/RSTRING_CLEN -> RSTRING_PTR/RSTRING_LEN

Modified Paths:
--------------
    MacRuby/trunk/Rakefile
    MacRuby/trunk/array.c
    MacRuby/trunk/bignum.c
    MacRuby/trunk/blockinlining.c
    MacRuby/trunk/compile.c
    MacRuby/trunk/complex.c
    MacRuby/trunk/dir.c
    MacRuby/trunk/encoding.c
    MacRuby/trunk/error.c
    MacRuby/trunk/eval.c
    MacRuby/trunk/eval_error.c
    MacRuby/trunk/ext/readline/readline.c
    MacRuby/trunk/ext/stringio/stringio.c
    MacRuby/trunk/ext/strscan/strscan.c
    MacRuby/trunk/ext/syck/rubyext.c
    MacRuby/trunk/ext/zlib/zlib.c
    MacRuby/trunk/file.c
    MacRuby/trunk/hash.c
    MacRuby/trunk/include/ruby/ruby.h
    MacRuby/trunk/io.c
    MacRuby/trunk/iseq.c
    MacRuby/trunk/load.c
    MacRuby/trunk/marshal.c
    MacRuby/trunk/numeric.c
    MacRuby/trunk/objc.m
    MacRuby/trunk/object.c
    MacRuby/trunk/pack.c
    MacRuby/trunk/parse.y
    MacRuby/trunk/proc.c
    MacRuby/trunk/process.c
    MacRuby/trunk/range.c
    MacRuby/trunk/rational.c
    MacRuby/trunk/re.c
    MacRuby/trunk/ruby.c
    MacRuby/trunk/signal.c
    MacRuby/trunk/sprintf.c
    MacRuby/trunk/string.c
    MacRuby/trunk/thread.c
    MacRuby/trunk/time.c
    MacRuby/trunk/transcode.c
    MacRuby/trunk/util.c
    MacRuby/trunk/variable.c
    MacRuby/trunk/vm.c
    MacRuby/trunk/vm_dump.c
    MacRuby/trunk/vm_eval.c
    MacRuby/trunk/vm_insnhelper.c

Modified: MacRuby/trunk/Rakefile
===================================================================
--- MacRuby/trunk/Rakefile	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/Rakefile	2008-07-09 23:03:30 UTC (rev 348)
@@ -252,6 +252,7 @@
     sh("/usr/bin/sed -f ./tool/ytab.sed -e \"/^#/s!y\.tab\.c!parse.c!\" y.tab.c > parse.c.new")
     if !File.exist?('parse.c') or File.read('parse.c.new') != File.read('parse.c')
       mv('parse.c.new', 'parse.c')
+      rm_f('parse.o')
     else
       rm('parse.c.new')
     end

Modified: MacRuby/trunk/array.c
===================================================================
--- MacRuby/trunk/array.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/array.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -1618,11 +1618,11 @@
 #else
     for (i=0; i<RARRAY_LEN(ary); i++) {
 	tmp = rb_check_string_type(RARRAY_AT(ary, i));
-	len += NIL_P(tmp) ? 10 : RSTRING_LEN(tmp);
+	len += NIL_P(tmp) ? 10 : RSTRING_BYTELEN(tmp);
     }
     if (!NIL_P(sep)) {
 	StringValue(sep);
-	len += RSTRING_LEN(sep) * (RARRAY_LEN(ary) - 1);
+	len += RSTRING_BYTELEN(sep) * (RARRAY_LEN(ary) - 1);
     }
     result = rb_str_buf_new(len);
 #endif
@@ -3703,9 +3703,9 @@
     }
     else {             /* this is the general case */
 	volatile VALUE t0 = tmpbuf(n,sizeof(long));
-	long *p = (long*)RSTRING_PTR(t0);
+	long *p = (long*)RSTRING_BYTEPTR(t0);
 	volatile VALUE t1 = tmpbuf(n,sizeof(int));
-	int *used = (int*)RSTRING_PTR(t1);
+	int *used = (int*)RSTRING_BYTEPTR(t1);
 #if WITH_OBJC
 	VALUE ary0 = rb_ary_dup(ary);
 #else
@@ -3788,7 +3788,7 @@
     }
     else {
 	volatile VALUE t0 = tmpbuf(n+1, sizeof(long));
-	long *stack = (long*)RSTRING_PTR(t0);
+	long *stack = (long*)RSTRING_BYTEPTR(t0);
 	long nlen = combi_len(len, n);
 	volatile VALUE cc = rb_ary_new2(n);
 	long lev = 0;
@@ -3839,8 +3839,8 @@
     int n = argc+1;    /* How many arrays we're operating on */
     volatile VALUE t0 = tmpbuf(n, sizeof(VALUE));
     volatile VALUE t1 = tmpbuf(n, sizeof(int));
-    VALUE *arrays = (VALUE*)RSTRING_PTR(t0); /* The arrays we're computing the product of */
-    int *counters = (int*)RSTRING_PTR(t1); /* The current position in each one */
+    VALUE *arrays = (VALUE*)RSTRING_BYTEPTR(t0); /* The arrays we're computing the product of */
+    int *counters = (int*)RSTRING_BYTEPTR(t1); /* The current position in each one */
     VALUE result;      /* The array we'll be returning */
     long i,j;
     long resultlen = 1;

Modified: MacRuby/trunk/bignum.c
===================================================================
--- MacRuby/trunk/bignum.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/bignum.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -600,10 +600,10 @@
 	s = StringValueCStr(str);
     }
     else {
-	s = RSTRING_CPTR(str);
+	s = RSTRING_PTR(str);
     }
     if (s) {
-	len = RSTRING_CLEN(str);
+	len = RSTRING_LEN(str);
 	if (s[len]) {		/* no sentinel somehow */
 	    char *p = ALLOCA_N(char, len+1);
 
@@ -895,8 +895,8 @@
 
     if (FIXNUM_P(x)) {
         VALUE str = rb_fix2str(x, base);
-        const char* str_ptr = RSTRING_CPTR(str);
-        long str_len = RSTRING_CLEN(str);
+        const char* str_ptr = RSTRING_PTR(str);
+        long str_len = RSTRING_LEN(str);
         if (trim) {
             if (FIX2INT(x) == 0) return 0;
             MEMCPY(ptr, str_ptr, char, str_len);
@@ -951,7 +951,7 @@
     n2 = big2str_find_n1(x, base);
     n1 = (n2 + 1) / 2;
     ss = rb_usascii_str_new(0, n2 + 1); /* plus one for sign */
-    ptr = RSTRING_PTR(ss); /* ok */
+    ptr = RSTRING_BYTEPTR(ss); /* ok */
     ptr[0] = RBIGNUM_SIGN(x) ? '+' : '-';
 
     hbase = base*base;

Modified: MacRuby/trunk/blockinlining.c
===================================================================
--- MacRuby/trunk/blockinlining.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/blockinlining.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -43,7 +43,7 @@
 				      parent, iseq->type,
 				      GC_GUARDED_PTR(builder));
     if (0) {
-	printf("%s\n", RSTRING_CPTR(ruby_iseq_disasm(iseqval)));
+	printf("%s\n", RSTRING_PTR(ruby_iseq_disasm(iseqval)));
     }
     iseq->cached_special_block = iseqval;
     iseq->cached_special_block_builder = builder;

Modified: MacRuby/trunk/compile.c
===================================================================
--- MacRuby/trunk/compile.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/compile.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -180,7 +180,7 @@
 #define ADD_ELEM(anchor, elem) ADD_ELEM(iseq, anchor, elem)
 #endif
 
-#define ruby_sourcefile		RSTRING_CPTR(iseq->filename)
+#define ruby_sourcefile		RSTRING_PTR(iseq->filename)
 
 #if WITH_OBJC
 # define iseq_add_mark_object(x,y)
@@ -1063,7 +1063,7 @@
 	  default:
 	    dump_disasm_list(FIRST_ELEMENT(anchor));
 	    dump_disasm_list(list);
-	    rb_compile_error(RSTRING_CPTR(iseq->filename), line,
+	    rb_compile_error(RSTRING_PTR(iseq->filename), line,
 			     "error: set_sequence");
 	    break;
 	}
@@ -1104,7 +1104,7 @@
 		/* operand check */
 		if (iobj->operand_size != len - 1) {
 		    dump_disasm_list(list);
-		    rb_compile_error(RSTRING_CPTR(iseq->filename), iobj->line_no,
+		    rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
 				     "operand size miss! (%d for %d)",
 				     iobj->operand_size, len - 1);
 		    return 0;
@@ -1119,7 +1119,7 @@
 			    /* label(destination position) */
 			    lobj = (LABEL *)operands[j];
 			    if (lobj->set != Qtrue) {
-				rb_compile_error(RSTRING_CPTR(iseq->filename), iobj->line_no,
+				rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
 						 "unknown label");
 			    }
 			    if (lobj->sp == -1) {
@@ -1144,7 +1144,7 @@
 				lobj = (LABEL *)(lv & ~1);
 
 				if (lobj->set != Qtrue) {
-				    rb_compile_error(RSTRING_CPTR(iseq->filename), iobj->line_no,
+				    rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
 						     "unknown label");
 				}
 				rb_hash_aset(map, obj, INT2FIX(lobj->position - (pos+len)));
@@ -1194,7 +1194,7 @@
 			}
 			break;
 		      default:
-			rb_compile_error(RSTRING_CPTR(iseq->filename), iobj->line_no,
+			rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
 					 "unknown operand type: %c", type);
 			return 0;
 		    }
@@ -1263,7 +1263,7 @@
 #if 0 /* XXX */
     /* this check need dead code elimination */
     if (sp != 1) {
-	rb_bug("SP is not 0 on %s (%d)\n", RSTRING_CPTR(iseq->name), sp);
+	rb_bug("SP is not 0 on %s (%d)\n", RSTRING_PTR(iseq->name), sp);
     }
 #endif
 
@@ -1764,7 +1764,7 @@
 		dump_disasm_list((LINK_ELEMENT *)iobj);
 		dump_disasm_list((LINK_ELEMENT *)lobj);
 		printf("\n-- %d, %d\n", lobj->sc_state, nstate);
-		rb_compile_error(RSTRING_CPTR(iseq->filename), iobj->lineno,
+		rb_compile_error(RSTRING_PTR(iseq->filename), iobj->lineno,
 				 "insn_set_sc_state error\n");
 		return 0;
 	    }
@@ -1866,7 +1866,7 @@
 			  case SCS_XX:
 			    goto normal_insn;
 			  default:
-			    rb_compile_error(RSTRING_CPTR(iseq->filename), iobj->line_no,
+			    rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no,
 					     "unreachable");
 			}
 			/* remove useless pop */
@@ -2537,7 +2537,7 @@
 make_name_for_block(rb_iseq_t *iseq)
 {
     if (iseq->parent_iseq == 0) {
-	return rb_sprintf("block in %s", RSTRING_CPTR(iseq->name));
+	return rb_sprintf("block in %s", RSTRING_PTR(iseq->name));
     }
     else {
 	int level = 1;
@@ -2546,7 +2546,7 @@
 	    ip = ip->parent_iseq;
 	    level++;
 	}
-	return rb_sprintf("block (%d levels) in %s", level, RSTRING_CPTR(ip->name));
+	return rb_sprintf("block (%d levels) in %s", level, RSTRING_PTR(ip->name));
     }
 }
 
@@ -4432,7 +4432,7 @@
 	LABEL *lfin = NEW_LABEL(nd_line(node));
 	LABEL *ltrue = NEW_LABEL(nd_line(node));
 	VALUE key = rb_sprintf("flipflag/%s-%p-%d",
-			       RSTRING_CPTR(iseq->name), iseq,
+			       RSTRING_PTR(iseq->name), iseq,
 			       iseq->compile_data->flip_cnt++);
 
 	iseq_add_mark_object_compile_time(iseq, key);
@@ -4816,7 +4816,7 @@
     if (sym == symRedo)   return  CATCH_TYPE_REDO;
     if (sym == symNext)   return CATCH_TYPE_NEXT;
     rb_raise(rb_eSyntaxError, "invalid exception symbol: %s",
-	     RSTRING_CPTR(rb_inspect(sym)));
+	     RSTRING_PTR(rb_inspect(sym)));
     return 0;
 }
 
@@ -4894,12 +4894,12 @@
 	    if (st_lookup(insn_table, insn, &insn_id) == 0) {
 		/* TODO: exception */
 		RB_GC_GUARD(insn) = rb_inspect(insn);
-		rb_compile_error(RSTRING_CPTR(iseq->filename), line_no,
-				 "unknown instruction: %s", RSTRING_CPTR(insn));
+		rb_compile_error(RSTRING_PTR(iseq->filename), line_no,
+				 "unknown instruction: %s", RSTRING_PTR(insn));
 	    }
 
 	    if (argc != insn_len(insn_id)-1) {
-		rb_compile_error(RSTRING_CPTR(iseq->filename), line_no,
+		rb_compile_error(RSTRING_PTR(iseq->filename), line_no,
 				 "operand size mismatch");
 	    }
 

Modified: MacRuby/trunk/complex.c
===================================================================
--- MacRuby/trunk/complex.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/complex.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -1201,7 +1201,7 @@
 
     s = f_strip(self);
 
-    if (RSTRING_CLEN(s) == 0)
+    if (RSTRING_LEN(s) == 0)
 	return rb_assoc_new(Qnil, self);
 
     {
@@ -1248,7 +1248,7 @@
 string_to_c_strict(VALUE self)
 {
     VALUE a = string_to_c_internal(self);
-    if (NIL_P(RARRAY_AT(a, 0)) || RSTRING_CLEN(RARRAY_AT(a, 1)) > 0) {
+    if (NIL_P(RARRAY_AT(a, 0)) || RSTRING_LEN(RARRAY_AT(a, 1)) > 0) {
 	VALUE s = f_inspect(self);
 	rb_raise(rb_eArgError, "invalid value for Complex: %s",
 		 StringValuePtr(s));

Modified: MacRuby/trunk/dir.c
===================================================================
--- MacRuby/trunk/dir.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/dir.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -386,7 +386,7 @@
     if (dp->path) free(dp->path);
     dp->dir = NULL;
     dp->path = NULL;
-    dirname_cstr = RSTRING_CPTR(dirname);
+    dirname_cstr = RSTRING_PTR(dirname);
     dp->dir = opendir(dirname_cstr);
     if (dp->dir == NULL) {
 	if (errno == EMFILE || errno == ENFILE) {
@@ -463,7 +463,7 @@
 	const char *c = rb_obj_classname(dir);
 	int len = strlen(c) + strlen(dirp->path) + 4;
 	VALUE s = rb_str_new(0, len);
-	snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
+	snprintf(RSTRING_BYTEPTR(s), len+1, "#<%s:%s>", c, dirp->path);
 	RSTRING_SYNC(s);
 	return s;
     }
@@ -682,7 +682,7 @@
 static void
 dir_chdir(VALUE path)
 {
-    const char *cpath = RSTRING_CPTR(path);
+    const char *cpath = RSTRING_PTR(path);
     if (chdir(cpath) < 0)
 	rb_sys_fail(cpath);
 }
@@ -828,7 +828,7 @@
 
     rb_secure(2);
     FilePathValue(*dir);
-    path = RSTRING_CPTR(*dir);
+    path = RSTRING_PTR(*dir);
     if (path && *(pend = rb_path_end(rb_path_skip_prefix(path)))) {
 	*dir = rb_str_new(path, pend - path);
     }
@@ -847,7 +847,7 @@
 dir_s_chroot(VALUE dir, VALUE path)
 {
 #if defined(HAVE_CHROOT) && !defined(__CHECKER__)
-    const char *path_cstr = RSTRING_CPTR(path);
+    const char *path_cstr = RSTRING_PTR(path);
 
     check_dirname(&path);
 
@@ -889,7 +889,7 @@
     }
 
     check_dirname(&path);
-    path_cstr = RSTRING_CPTR(path);
+    path_cstr = RSTRING_PTR(path);
     if (mkdir(path_cstr, mode) == -1)
 	rb_sys_fail(path_cstr);
 
@@ -911,7 +911,7 @@
     const char *dir_cstr;
 
     check_dirname(&dir);
-    dir_cstr = RSTRING_CPTR(dir);
+    dir_cstr = RSTRING_PTR(dir);
     if (rmdir(dir_cstr) < 0)
 	rb_sys_fail(dir_cstr);
 
@@ -1559,8 +1559,8 @@
 
     StringValue(str);
     ary = rb_ary_new();
-    cstr = RSTRING_CPTR(str);
-    clen = RSTRING_CLEN(str);
+    cstr = RSTRING_PTR(str);
+    clen = RSTRING_LEN(str);
 
     while (offset < clen) {
 	int status = push_glob(ary, cstr + offset, flags);
@@ -1588,7 +1588,7 @@
 	int status;
 	VALUE str = argv[i];
 	StringValue(str);
-	status = push_glob(ary, RSTRING_CPTR(str), flags);
+	status = push_glob(ary, RSTRING_PTR(str), flags);
 	if (status) GLOB_JUMP_TAG(status);
     }
 
@@ -1606,7 +1606,7 @@
 	int status;
 	VALUE str = RARRAY_AT(args, i);
 	StringValue(str);
-	status = push_glob(ary, RSTRING_CPTR(str), flags);
+	status = push_glob(ary, RSTRING_PTR(str), flags);
 	if (status) 
 	    GLOB_JUMP_TAG(status);
     }
@@ -1883,7 +1883,7 @@
     StringValue(pattern);
     FilePathStringValue(path);
 
-    if (fnmatch(RSTRING_CPTR(pattern), RSTRING_CPTR(path), flags) == 0)
+    if (fnmatch(RSTRING_PTR(pattern), RSTRING_PTR(path), flags) == 0)
 	return Qtrue;
 
     return Qfalse;

Modified: MacRuby/trunk/encoding.c
===================================================================
--- MacRuby/trunk/encoding.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/encoding.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -49,7 +49,7 @@
 	    const char *name;
 	    char *p;
 
-	    name = RSTRING_CPTR(iana);
+	    name = RSTRING_PTR(iana);
 	    p = strchr(name, '-');
 	    if ((p = strchr(name, '-')) != NULL
 		|| islower(*name)) {
@@ -213,7 +213,7 @@
     idx = enc_check_encoding(enc);
     if (idx >= 0) return RDATA(enc)->data;
     if ((idx = rb_enc_find_index(StringValueCStr(enc))) < 0) {
-	rb_raise(rb_eArgError, "unknown encoding name - %s", RSTRING_PTR(enc));
+	rb_raise(rb_eArgError, "unknown encoding name - %s", RSTRING_BYTEPTR(enc));
     }
     return rb_enc_from_index(idx);
 }
@@ -535,7 +535,7 @@
     VALUE verbose = ruby_verbose;
     VALUE debug = ruby_debug;
     VALUE loaded;
-    char *s = RSTRING_PTR(enclib) + 4, *e = RSTRING_END(enclib);
+    char *s = RSTRING_BYTEPTR(enclib) + 4, *e = RSTRING_END(enclib);
     int idx;
 
     while (s < e) {
@@ -627,7 +627,7 @@
 	    etype = "Symbol";
 	}
 	else if (rb_special_const_p(x)) {
-	    etype = RSTRING_PTR(rb_obj_as_string(x));
+	    etype = RSTRING_BYTEPTR(rb_obj_as_string(x));
 	}
 	else {
 	    etype = rb_obj_classname(x);
@@ -743,9 +743,9 @@
     enc1 = rb_enc_from_index(idx1);
     enc2 = rb_enc_from_index(idx2);
 
-    if (TYPE(str2) == T_STRING && RSTRING_LEN(str2) == 0)
+    if (TYPE(str2) == T_STRING && RSTRING_BYTELEN(str2) == 0)
 	return enc1;
-    if (TYPE(str1) == T_STRING && RSTRING_LEN(str1) == 0)
+    if (TYPE(str1) == T_STRING && RSTRING_BYTELEN(str1) == 0)
 	return enc2;
     if (!rb_enc_asciicompat(enc1) || !rb_enc_asciicompat(enc2)) {
 	return 0;
@@ -911,7 +911,7 @@
     enc_name = (VALUE)CFStringGetNameOfEncoding(rb_enc_to_enc(self));
     
     n = snprintf(buffer, sizeof buffer, "#<%s:%s>", rb_obj_classname(self),
-	RSTRING_CPTR(enc_name));
+	RSTRING_PTR(enc_name));
 
     return rb_str_new(buffer, n);
 #else
@@ -1031,7 +1031,7 @@
 #if WITH_OBJC
     VALUE e = enc_find2(enc);
     if (e == Qnil)
-	rb_raise(rb_eArgError, "unknown encoding name - %s", RSTRING_PTR(enc));
+	rb_raise(rb_eArgError, "unknown encoding name - %s", RSTRING_BYTEPTR(enc));
     return e;
 #else
     int idx;
@@ -1042,7 +1042,7 @@
     }
     idx = rb_enc_find_index(StringValueCStr(enc));
     if (idx < 0) {
-	rb_raise(rb_eArgError, "unknown encoding name - %s", RSTRING_PTR(enc));
+	rb_raise(rb_eArgError, "unknown encoding name - %s", RSTRING_BYTEPTR(enc));
     }
     return rb_enc_from_encoding(rb_enc_from_index(idx));
 #endif
@@ -1395,7 +1395,7 @@
 rb_enc_name(rb_encoding *enc)
 {
     VALUE str = rb_enc_name2(enc);
-    return str == Qnil ? NULL : RSTRING_CPTR(str);
+    return str == Qnil ? NULL : RSTRING_PTR(str);
 }
 
 long 

Modified: MacRuby/trunk/error.c
===================================================================
--- MacRuby/trunk/error.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/error.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -293,7 +293,7 @@
 		    etype = "Symbol";
 		}
 		else if (rb_special_const_p(x)) {
-		    etype = RSTRING_CPTR(rb_obj_as_string(x));
+		    etype = RSTRING_PTR(rb_obj_as_string(x));
 		}
 		else {
 		    etype = rb_obj_classname(x);
@@ -450,7 +450,7 @@
 
     klass = CLASS_OF(exc);
     exc = rb_obj_as_string(exc);
-    if (RSTRING_CLEN(exc) == 0) {
+    if (RSTRING_LEN(exc) == 0) {
 	return rb_str_dup(rb_class_name(klass));
     }
 
@@ -771,10 +771,10 @@
 	    break;
 	  default:
 	    d = rb_protect(rb_inspect, obj, 0);
-	    if (NIL_P(d) || RSTRING_CLEN(d) > 65) {
+	    if (NIL_P(d) || RSTRING_LEN(d) > 65) {
 		d = rb_any_to_s(obj);
 	    }
-	    desc = RSTRING_CPTR(d);
+	    desc = RSTRING_PTR(d);
 	    break;
 	}
 	if (desc && desc[0] != '#') {
@@ -817,7 +817,7 @@
 {
     VALUE s = rb_str_inspect(rb_str_new2(str));
 
-    rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING_CPTR(s));
+    rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING_PTR(s));
 }
 
 /* 
@@ -928,7 +928,7 @@
 
 	StringValue(str);
 	mesg = rb_sprintf("%s - %.*s", err,
-			  (int)RSTRING_CLEN(str), RSTRING_CPTR(str));
+			  (int)RSTRING_LEN(str), RSTRING_PTR(str));
     }
     else {
 	mesg = rb_str_new2(err);

Modified: MacRuby/trunk/eval.c
===================================================================
--- MacRuby/trunk/eval.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/eval.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -399,12 +399,12 @@
 	    if (file) {
 		warn_printf("Exception `%s' at %s:%d - %s\n",
 			    rb_obj_classname(th->errinfo),
-			    file, line, RSTRING_CPTR(e));
+			    file, line, RSTRING_PTR(e));
 	    }
 	    else {
 		warn_printf("Exception `%s' - %s\n",
 			    rb_obj_classname(th->errinfo),
-			    RSTRING_CPTR(e));
+			    RSTRING_PTR(e));
 	    }
 	}
 	POP_TAG();

Modified: MacRuby/trunk/eval_error.c
===================================================================
--- MacRuby/trunk/eval_error.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/eval_error.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -101,7 +101,7 @@
 	if (NIL_P(mesg))
 	    error_pos();
 	else {
-	    warn_print2(RSTRING_CPTR(mesg), RSTRING_CLEN(mesg));
+	    warn_print2(RSTRING_PTR(mesg), RSTRING_LEN(mesg));
 	}
     }
 
@@ -109,8 +109,8 @@
     if (EXEC_TAG() == 0) {
 	e = rb_funcall(errinfo, rb_intern("message"), 0, 0);
 	StringValue(e);
-	einfo = RSTRING_CPTR(e);
-	elen = RSTRING_CLEN(e);
+	einfo = RSTRING_PTR(e);
+	elen = RSTRING_LEN(e);
     }
     else {
 	einfo = "";
@@ -127,14 +127,14 @@
 	epath = rb_class_name(eclass);
 	if (elen == 0) {
 	    warn_print(": ");
-	    warn_print2(RSTRING_CPTR(epath), RSTRING_CLEN(epath));
+	    warn_print2(RSTRING_PTR(epath), RSTRING_LEN(epath));
 	    warn_print("\n");
 	}
 	else {
 	    char *tail = 0;
 	    long len = elen;
 
-	    if (RSTRING_CPTR(epath)[0] == '#')
+	    if (RSTRING_PTR(epath)[0] == '#')
 		epath = 0;
 	    if ((tail = memchr(einfo, '\n', elen)) != 0) {
 		len = tail - einfo;
@@ -144,7 +144,7 @@
 	    warn_print2(einfo, len);
 	    if (epath) {
 		warn_print(" (");
-		warn_print2(RSTRING_CPTR(epath), RSTRING_CLEN(epath));
+		warn_print2(RSTRING_PTR(epath), RSTRING_LEN(epath));
 		warn_print(")\n");
 	    }
 	    if (tail) {
@@ -166,7 +166,7 @@
 	for (i = 1; i < len; i++) {
 	    VALUE v = RARRAY_AT(errat, i);
 	    if (TYPE(v) == T_STRING) {
-		warn_printf("\tfrom %s\n", RSTRING_CPTR(v));
+		warn_printf("\tfrom %s\n", RSTRING_PTR(v));
 	    }
 	    if (skip && i == TRACE_HEAD && len > TRACE_MAX) {
 		warn_printf("\t ... %ld levels...\n",

Modified: MacRuby/trunk/ext/readline/readline.c
===================================================================
--- MacRuby/trunk/ext/readline/readline.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/ext/readline/readline.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -88,7 +88,7 @@
     rb_secure(4);
     if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
 	SafeStringValue(tmp);
-	prompt = RSTRING_CPTR(tmp);
+	prompt = RSTRING_PTR(tmp);
     }
 
     if (!isatty(0) && errno == EBADF) rb_raise(rb_eIOError, "stdin closed");
@@ -203,8 +203,8 @@
     result = ALLOC_N(char *, matches + 2);
     for (i = 0; i < matches; i++) {
 	temp = rb_obj_as_string(RARRAY_AT(ary, i));
-	result[i + 1] = ALLOC_N(char, RSTRING_CLEN(temp) + 1);
-	strcpy(result[i + 1], RSTRING_CPTR(temp));
+	result[i + 1] = ALLOC_N(char, RSTRING_LEN(temp) + 1);
+	strcpy(result[i + 1], RSTRING_PTR(temp));
     }
     result[matches + 1] = NULL;
 
@@ -279,10 +279,10 @@
     }
     else {
 	SafeStringValue(str);
-	if (RSTRING_CLEN(str) == 0) {
+	if (RSTRING_LEN(str) == 0) {
 	    rl_completion_append_character = '\0';
 	} else {
-	    rl_completion_append_character = RSTRING_CPTR(str)[0];
+	    rl_completion_append_character = RSTRING_PTR(str)[0];
 	}
     }
     return self;
@@ -320,14 +320,14 @@
     SafeStringValue(str);
     if (basic_word_break_characters == NULL) {
 	basic_word_break_characters =
-	    ALLOC_N(char, RSTRING_CLEN(str) + 1);
+	    ALLOC_N(char, RSTRING_LEN(str) + 1);
     }
     else {
-	REALLOC_N(basic_word_break_characters, char, RSTRING_CLEN(str) + 1);
+	REALLOC_N(basic_word_break_characters, char, RSTRING_LEN(str) + 1);
     }
     strncpy(basic_word_break_characters,
-	    RSTRING_CPTR(str), RSTRING_CLEN(str));
-    basic_word_break_characters[RSTRING_CLEN(str)] = '\0';
+	    RSTRING_PTR(str), RSTRING_LEN(str));
+    basic_word_break_characters[RSTRING_LEN(str)] = '\0';
     rl_basic_word_break_characters = basic_word_break_characters;
     return self;
 #else
@@ -360,14 +360,14 @@
     SafeStringValue(str);
     if (completer_word_break_characters == NULL) {
 	completer_word_break_characters =
-	    ALLOC_N(char, RSTRING_CLEN(str) + 1);
+	    ALLOC_N(char, RSTRING_LEN(str) + 1);
     }
     else {
-	REALLOC_N(completer_word_break_characters, char, RSTRING_CLEN(str) + 1);
+	REALLOC_N(completer_word_break_characters, char, RSTRING_LEN(str) + 1);
     }
     strncpy(completer_word_break_characters,
-	    RSTRING_CPTR(str), RSTRING_CLEN(str));
-    completer_word_break_characters[RSTRING_CLEN(str)] = '\0';
+	    RSTRING_PTR(str), RSTRING_LEN(str));
+    completer_word_break_characters[RSTRING_LEN(str)] = '\0';
     rl_completer_word_break_characters = completer_word_break_characters;
     return self;
 #else
@@ -400,14 +400,14 @@
     SafeStringValue(str);
     if (basic_quote_characters == NULL) {
 	basic_quote_characters =
-	    ALLOC_N(char, RSTRING_CLEN(str) + 1);
+	    ALLOC_N(char, RSTRING_LEN(str) + 1);
     }
     else {
-	REALLOC_N(basic_quote_characters, char, RSTRING_CLEN(str) + 1);
+	REALLOC_N(basic_quote_characters, char, RSTRING_LEN(str) + 1);
     }
     strncpy(basic_quote_characters,
-	    RSTRING_CPTR(str), RSTRING_CLEN(str));
-    basic_quote_characters[RSTRING_CLEN(str)] = '\0';
+	    RSTRING_PTR(str), RSTRING_LEN(str));
+    basic_quote_characters[RSTRING_LEN(str)] = '\0';
     rl_basic_quote_characters = basic_quote_characters;
 
     return self;
@@ -441,13 +441,13 @@
     SafeStringValue(str);
     if (completer_quote_characters == NULL) {
 	completer_quote_characters =
-	    ALLOC_N(char, RSTRING_CLEN(str) + 1);
+	    ALLOC_N(char, RSTRING_LEN(str) + 1);
     }
     else {
-	REALLOC_N(completer_quote_characters, char, RSTRING_CLEN(str) + 1);
+	REALLOC_N(completer_quote_characters, char, RSTRING_LEN(str) + 1);
     }
-    strncpy(completer_quote_characters, RSTRING_CPTR(str), RSTRING_CLEN(str));
-    completer_quote_characters[RSTRING_CLEN(str)] = '\0';
+    strncpy(completer_quote_characters, RSTRING_PTR(str), RSTRING_LEN(str));
+    completer_quote_characters[RSTRING_LEN(str)] = '\0';
     rl_completer_quote_characters = completer_quote_characters;
 
     return self;
@@ -481,13 +481,13 @@
     SafeStringValue(str);
     if (filename_quote_characters == NULL) {
 	filename_quote_characters =
-	    ALLOC_N(char, RSTRING_CLEN(str) + 1);
+	    ALLOC_N(char, RSTRING_LEN(str) + 1);
     }
     else {
-	REALLOC_N(filename_quote_characters, char, RSTRING_CLEN(str) + 1);
+	REALLOC_N(filename_quote_characters, char, RSTRING_LEN(str) + 1);
     }
-    strncpy(filename_quote_characters, RSTRING_CPTR(str), RSTRING_CLEN(str));
-    filename_quote_characters[RSTRING_CLEN(str)] = '\0';
+    strncpy(filename_quote_characters, RSTRING_PTR(str), RSTRING_LEN(str));
+    filename_quote_characters[RSTRING_LEN(str)] = '\0';
     rl_filename_quote_characters = filename_quote_characters;
 
     return self;
@@ -548,7 +548,7 @@
     if (i < 0) {
         i += history_length;
     }
-    entry = replace_history_entry(i, RSTRING_CPTR(str), NULL);
+    entry = replace_history_entry(i, RSTRING_PTR(str), NULL);
     if (entry == NULL) {
 	rb_raise(rb_eIndexError, "invalid index");
     }
@@ -564,7 +564,7 @@
 {
     rb_secure(4);
     SafeStringValue(str);
-    add_history(RSTRING_CPTR(str));
+    add_history(RSTRING_PTR(str));
     return self;
 }
 
@@ -577,7 +577,7 @@
     while (argc--) {
 	str = *argv++;
 	SafeStringValue(str);
-	add_history(RSTRING_CPTR(str));
+	add_history(RSTRING_PTR(str));
     }
     return self;
 }

Modified: MacRuby/trunk/ext/stringio/stringio.c
===================================================================
--- MacRuby/trunk/ext/stringio/stringio.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/ext/stringio/stringio.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -637,7 +637,7 @@
     struct StringIO *ptr = readable(StringIO(self));
     rb_encoding *enc = rb_enc_get(ptr->string);
     int len;
-    char *p;
+    const char *p;
 
     if (ptr->pos >= RSTRING_LEN(ptr->string)) {
 	return Qnil;
@@ -680,7 +680,11 @@
     if (pos + len > olen) {
 	rb_str_resize(ptr->string, pos + len);
 	if (pos > olen)
+#if WITH_OBJC
+	    CFStringDelete((CFMutableStringRef)ptr->string, CFRangeMake(olen, pos - olen));
+#else
 	    MEMZERO(RSTRING_PTR(ptr->string) + olen, char, pos - olen);
+#endif
     }
     else {
 	rb_str_modify(ptr->string);
@@ -702,7 +706,7 @@
 {
     struct StringIO *ptr = readable(StringIO(self));
     long lpos, clen;
-    char *p, *pend;
+    const char *p, *pend;
     rb_encoding *enc;
 
     if (NIL_P(c)) return Qnil;
@@ -1018,7 +1022,11 @@
     }
     else {
 	strio_extend(ptr, ptr->pos, len);
+#if WITH_OBJC
+	CFStringReplace((CFMutableStringRef)ptr->string, CFRangeMake(ptr->pos, len), (CFStringRef)str);
+#else
 	memmove(RSTRING_PTR(ptr->string)+ptr->pos, RSTRING_PTR(str), len);
+#endif
 	OBJ_INFECT(ptr->string, str);
     }
     OBJ_INFECT(ptr->string, self);
@@ -1070,7 +1078,13 @@
 	ptr->pos = olen;
     }
     strio_extend(ptr, ptr->pos, 1);
+#if WITH_OBJC
+    CFStringRef tmp_str = CFStringCreateWithCharacters(NULL, (const UniChar *)&c, 1);
+    CFStringReplace((CFMutableStringRef)ptr->string, CFRangeMake(ptr->pos, 1), tmp_str);
+    CFRelease(tmp_str);
+#else
     RSTRING_PTR(ptr->string)[ptr->pos++] = c;
+#endif
     OBJ_INFECT(ptr->string, self);
     return ch;
 }

Modified: MacRuby/trunk/ext/strscan/strscan.c
===================================================================
--- MacRuby/trunk/ext/strscan/strscan.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/ext/strscan/strscan.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -42,13 +42,13 @@
 #define MATCHED(s)             (s)->flags |= FLAG_MATCHED
 #define CLEAR_MATCH_STATUS(s)  (s)->flags &= ~FLAG_MATCHED
 
-#define S_PBEG(s)  (RSTRING_CPTR((s)->str))
-#define S_LEN(s)  (RSTRING_CLEN((s)->str))
+#define S_PBEG(s)  (RSTRING_PTR((s)->str))
+#define S_LEN(s)  (RSTRING_LEN((s)->str))
 #define S_PEND(s)  (S_PBEG(s) + S_LEN(s))
 #define CURPTR(s) (S_PBEG(s) + (s)->curr)
 #define S_RESTLEN(s) (S_LEN(s) - (s)->curr)
 
-#define EOS_P(s) ((s)->curr >= RSTRING_CLEN(p->str))
+#define EOS_P(s) ((s)->curr >= RSTRING_LEN(p->str))
 
 #define GET_SCANNER(obj,var) do {\
     Data_Get_Struct(obj, struct strscanner, var);\
@@ -1089,7 +1089,7 @@
         len = snprintf(buf, BUFSIZE, "#<%s %ld/%ld @ %s>",
                        rb_class2name(CLASS_OF(self)),
                        p->curr, S_LEN(p),
-                       RSTRING_CPTR(b));
+                       RSTRING_PTR(b));
         return infect(rb_str_new(buf, len), p);
     }
     a = inspect1(p);
@@ -1097,8 +1097,8 @@
     len = snprintf(buf, BUFSIZE, "#<%s %ld/%ld %s @ %s>",
                    rb_class2name(CLASS_OF(self)),
                    p->curr, S_LEN(p),
-                   RSTRING_CPTR(a),
-                   RSTRING_CPTR(b));
+                   RSTRING_PTR(a),
+                   RSTRING_PTR(b));
     return infect(rb_str_new(buf, len), p);
 }
 

Modified: MacRuby/trunk/ext/syck/rubyext.c
===================================================================
--- MacRuby/trunk/ext/syck/rubyext.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/ext/syck/rubyext.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -150,8 +150,8 @@
         if (!NIL_P(str2))
         {
             StringValue(str2);
-            len = RSTRING_CLEN(str2);
-            memcpy( buf + skip, RSTRING_CPTR(str2), len );
+            len = RSTRING_LEN(str2);
+            memcpy( buf + skip, RSTRING_PTR(str2), len );
         }
     }
     len += skip;
@@ -171,7 +171,7 @@
     if (!NIL_P(tmp = rb_check_string_type(port))) {
         taint = OBJ_TAINTED(port); /* original taintedness */
         port = tmp;
-        syck_parser_str( parser, RSTRING_CPTR(port), RSTRING_CLEN(port), NULL );
+        syck_parser_str( parser, RSTRING_PTR(port), RSTRING_LEN(port), NULL );
     }
     else if (rb_respond_to(port, s_read)) {
         if (rb_respond_to(port, s_binmode)) {
@@ -1013,10 +1013,10 @@
     VALUE ivname = rb_ary_entry( vars, 0 );
     char *ivn;
     StringValue( ivname );
-    ivn = S_ALLOCA_N( char, RSTRING_CLEN(ivname) + 2 );
+    ivn = S_ALLOCA_N( char, RSTRING_LEN(ivname) + 2 );
     ivn[0] = '@';
     ivn[1] = '\0';
-    strncat( ivn, RSTRING_CPTR(ivname), RSTRING_CLEN(ivname) );
+    strncat( ivn, RSTRING_PTR(ivname), RSTRING_LEN(ivname) );
     rb_iv_set( obj, ivn, rb_ary_entry( vars, 1 ) );
     return Qnil;
 }
@@ -1044,12 +1044,12 @@
 VALUE
 syck_resolver_transfer(VALUE self, VALUE type, VALUE val)
 {
-    if (NIL_P(type) || RSTRING_CLEN(StringValue(type)) == 0) 
+    if (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0) 
     {
         type = rb_funcall( self, s_detect_implicit, 1, val );
     }
 
-    if ( ! (NIL_P(type) || RSTRING_CLEN(StringValue(type)) == 0) )
+    if ( ! (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0) )
     {
         VALUE str_xprivate = rb_str_new2( "x-private" );
         VALUE tags = rb_attr_get(self, s_tags);
@@ -1178,7 +1178,7 @@
 
     if ( !NIL_P(tmp) )
     {
-        char *taguri = syck_type_id_to_uri( RSTRING_CPTR(tmp) );
+        char *taguri = syck_type_id_to_uri( RSTRING_PTR(tmp) );
         val = rb_str_new2( taguri );
         S_FREE( taguri );
     }
@@ -1198,7 +1198,7 @@
     if ( !NIL_P(tmp) )
     {
         val = tmp;
-        type_id = syck_match_implicit( RSTRING_CPTR(val), RSTRING_CLEN(val) );
+        type_id = syck_match_implicit( RSTRING_PTR(val), RSTRING_LEN(val) );
         return rb_str_new2( type_id );
     }
 
@@ -1457,8 +1457,8 @@
     Data_Get_Struct( self, SyckNode, node );
 
     StringValue( val );
-    node->data.str->ptr = syck_strndup( RSTRING_CPTR(val), RSTRING_CLEN(val) );
-    node->data.str->len = RSTRING_CLEN(val);
+    node->data.str->ptr = syck_strndup( RSTRING_PTR(val), RSTRING_LEN(val) );
+    node->data.str->len = RSTRING_LEN(val);
     node->data.str->style = scalar_none;
 
     rb_iv_set( self, "@value", val );
@@ -1717,7 +1717,7 @@
 
     if ( !NIL_P( type_id ) ) {
         StringValue( type_id );
-        node->type_id = syck_strndup( RSTRING_CPTR(type_id), RSTRING_CLEN(type_id) );
+        node->type_id = syck_strndup( RSTRING_PTR(type_id), RSTRING_LEN(type_id) );
     }
 
     rb_iv_set( self, "@type_id", type_id );

Modified: MacRuby/trunk/ext/zlib/zlib.c
===================================================================
--- MacRuby/trunk/ext/zlib/zlib.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/ext/zlib/zlib.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -434,7 +434,11 @@
 	z->buf_filled = 0;
 	z->stream.next_out = (Bytef*)RSTRING_PTR(z->buf);
 	z->stream.avail_out = ZSTREAM_INITIAL_BUFSIZE;
+#if WITH_OBJC
+	RSTRING_BYTEPTR(z->buf); /* force bytestring creation */
+#else
 	RBASIC(z->buf)->klass = 0;
+#endif
 	return;
     }
 
@@ -557,8 +561,12 @@
 	zstream_expand_buffer(z);
     }
 
+#if WITH_OBJC
+    CFStringInsert((CFMutableStringRef)z->buf, 0, rb_str_new(&c, 1));
+#else
     memmove(RSTRING_PTR(z->buf) + 1, RSTRING_PTR(z->buf), z->buf_filled);
     RSTRING_PTR(z->buf)[0] = (char)c;
+#endif
     z->buf_filled++;
     if (z->stream.avail_out > 0) {
 	z->stream.next_out++;

Modified: MacRuby/trunk/file.c
===================================================================
--- MacRuby/trunk/file.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/file.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -833,7 +833,7 @@
     rb_secure(2);
     FilePathValue(fname);
     if (lstat(StringValueCStr(fname), &st) == -1) {
-	rb_sys_fail(RSTRING_CPTR(fname));
+	rb_sys_fail(RSTRING_PTR(fname));
     }
     return stat_new(&st);
 #else
@@ -1569,13 +1569,13 @@
     FilePathValue(fname1);
     fname1 = rb_str_new4(fname1);
     FilePathValue(fname2);
-    if (access(RSTRING_CPTR(fname1), 0)) return Qfalse;
-    if (access(RSTRING_CPTR(fname2), 0)) return Qfalse;
+    if (access(RSTRING_PTR(fname1), 0)) return Qfalse;
+    if (access(RSTRING_PTR(fname2), 0)) return Qfalse;
 #endif
     fname1 = rb_file_expand_path(fname1, Qnil);
     fname2 = rb_file_expand_path(fname2, Qnil);
-    if (RSTRING_CLEN(fname1) != RSTRING_CLEN(fname2)) return Qfalse;
-    if (rb_memcicmp(RSTRING_CPTR(fname1), RSTRING_CPTR(fname2), RSTRING_CLEN(fname1)))
+    if (RSTRING_LEN(fname1) != RSTRING_LEN(fname2)) return Qfalse;
+    if (rb_memcicmp(RSTRING_PTR(fname1), RSTRING_PTR(fname2), RSTRING_LEN(fname1)))
 	return Qfalse;
 #endif
     return Qtrue;
@@ -1662,7 +1662,7 @@
     rb_secure(2);
     FilePathValue(fname);
     if (lstat(StringValueCStr(fname), &st) == -1) {
-	rb_sys_fail(RSTRING_CPTR(fname));
+	rb_sys_fail(RSTRING_PTR(fname));
     }
 
     return rb_file_ftype(&st);
@@ -1728,7 +1728,7 @@
     struct stat st;
 
     if (rb_stat(fname, &st) < 0)
-	rb_sys_fail(RSTRING_CPTR(fname));
+	rb_sys_fail(RSTRING_PTR(fname));
     return stat_mtime(&st);
 }
 
@@ -1773,7 +1773,7 @@
     struct stat st;
 
     if (rb_stat(fname, &st) < 0)
-	rb_sys_fail(RSTRING_CPTR(fname));
+	rb_sys_fail(RSTRING_PTR(fname));
     return stat_ctime(&st);
 }
 
@@ -2163,7 +2163,7 @@
 #endif
     const char *e1, *e2;
     int len = 5;
-    int l1 = RSTRING_CLEN(s1), l2 = RSTRING_CLEN(s2);
+    int l1 = RSTRING_LEN(s1), l2 = RSTRING_LEN(s2);
 
     e1 = e2 = "";
     if (l1 > max_pathlen) {
@@ -2179,8 +2179,8 @@
     len += l1 + l2;
     buf = ALLOCA_N(char, len);
     snprintf(buf, len, "(%.*s%s, %.*s%s)",
-	     l1, RSTRING_CPTR(s1), e1,
-	     l2, RSTRING_CPTR(s2), e2);
+	     l1, RSTRING_PTR(s1), e1,
+	     l2, RSTRING_PTR(s2), e2);
     rb_sys_fail(buf);
 }
 
@@ -2267,7 +2267,7 @@
     rb_secure(2);
     FilePathValue(path);
     buf = xmalloc(size);
-    while ((rv = readlink(RSTRING_CPTR(path), buf, size)) == size
+    while ((rv = readlink(RSTRING_PTR(path), buf, size)) == size
 #ifdef _AIX
 	    || (rv < 0 && errno == ERANGE) /* quirky behavior of GPFS */
 #endif
@@ -2277,7 +2277,7 @@
     }
     if (rv < 0) {
 	free(buf);
-	rb_sys_fail(RSTRING_CPTR(path));
+	rb_sys_fail(RSTRING_PTR(path));
     }
     v = rb_tainted_str_new(buf, rv);
     xfree(buf);
@@ -2581,15 +2581,15 @@
     if (cond) {\
 	do {buflen *= 2;} while (cond);\
 	rb_str_resize(result, buflen);\
-	buf = RSTRING_PTR(result);\
+	buf = RSTRING_BYTEPTR(result);\
 	p = buf + bdiff;\
 	pend = buf + buflen;\
     }\
 } while (0)
 
 #define BUFINIT() (\
-    p = buf = RSTRING_PTR(result),\
-    buflen = RSTRING_LEN(result),\
+    p = buf = RSTRING_BYTEPTR(result),\
+    buflen = RSTRING_BYTELEN(result),\
     pend = p + buflen)
 
 #if WITH_OBJC
@@ -2708,7 +2708,7 @@
 	    file_expand_path(dname, Qnil, result);
 	    BUFINIT();
 #if WITH_OBJC
-	    n = RSTRING_CLEN(result);
+	    n = RSTRING_LEN(result);
 	    BUFCHECK(n + 2 > buflen);
 #endif
 	}
@@ -2997,7 +2997,7 @@
 	StringValue(fext);
     }
     FilePathStringValue(fname);
-    if (RSTRING_CLEN(fname) == 0 || !*(name = RSTRING_CPTR(fname)))
+    if (RSTRING_LEN(fname) == 0 || !*(name = RSTRING_PTR(fname)))
 	return fname;
     name = skipprefix(name);
 #if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC
@@ -3040,7 +3040,7 @@
 	if (NIL_P(fext) || !(f = rmext(p, n, StringValueCStr(fext)))) {
 	    f = n;
 	}
-	if (f == RSTRING_CLEN(fname)) return fname;
+	if (f == RSTRING_LEN(fname)) return fname;
     }
     basename = rb_str_new(p, f);
 #if !WITH_OBJC
@@ -3259,7 +3259,7 @@
     len = 1;
     for (i=0, count=RARRAY_LEN(ary); i<count; i++) {
 	if (TYPE(RARRAY_AT(ary, i)) == T_STRING) {
-	    len += RSTRING_LEN(RARRAY_AT(ary, i));
+	    len += RSTRING_BYTELEN(RARRAY_AT(ary, i));
 	}
 	else {
 	    len += 10;
@@ -3267,7 +3267,7 @@
     }
     if (!NIL_P(sep)) {
 	StringValue(sep);
-	len += RSTRING_LEN(sep) * RARRAY_LEN(ary) - 1;
+	len += RSTRING_BYTELEN(sep) * RARRAY_LEN(ary) - 1;
     }
     result = rb_str_buf_new(len);
     OBJ_INFECT(result, ary);
@@ -3291,7 +3291,7 @@
 	name = StringValueCStr(result);
 	if (i > 0 && !NIL_P(sep)) {
 	    tail = chompdirsep(name);
-	    if (RSTRING_PTR(tmp) && isdirsep(RSTRING_PTR(tmp)[0])) {
+	    if (RSTRING_BYTEPTR(tmp) && isdirsep(RSTRING_BYTEPTR(tmp)[0])) {
 		rb_str_set_len(result, tail - name);
 	    }
 	    else if (!*tail) {
@@ -3347,7 +3347,7 @@
     FilePathValue(path);
 #ifdef HAVE_TRUNCATE
     if (truncate(StringValueCStr(path), pos) < 0)
-	rb_sys_fail(RSTRING_CPTR(path));
+	rb_sys_fail(RSTRING_PTR(path));
 #else
 # ifdef HAVE_CHSIZE
     {
@@ -3355,16 +3355,16 @@
 
 #  ifdef _WIN32
 	if ((tmpfd = open(StringValueCStr(path), O_RDWR)) < 0) {
-	    rb_sys_fail(RSTRING_CPTR(path));
+	    rb_sys_fail(RSTRING_PTR(path));
 	}
 #  else
 	if ((tmpfd = open(StringValueCStr(path), 0)) < 0) {
-	    rb_sys_fail(RSTRING_CPTR(path));
+	    rb_sys_fail(RSTRING_PTR(path));
 	}
 #  endif
 	if (chsize(tmpfd, pos) < 0) {
 	    close(tmpfd);
-	    rb_sys_fail(RSTRING_CPTR(path));
+	    rb_sys_fail(RSTRING_PTR(path));
 	}
 	close(tmpfd);
     }
@@ -3688,7 +3688,7 @@
 
 	CHECK(1);
 	if (rb_stat(argv[1], &st) == -1) {
-	    rb_sys_fail(RSTRING_CPTR(argv[1]));
+	    rb_sys_fail(RSTRING_PTR(argv[1]));
 	}
 
 	switch (cmd) {
@@ -3777,7 +3777,7 @@
     rb_secure(2);
     FilePathValue(fname);
     if (stat(StringValueCStr(fname), &st) == -1) {
-	rb_sys_fail(RSTRING_CPTR(fname));
+	rb_sys_fail(RSTRING_PTR(fname));
     }
     if (DATA_PTR(obj)) {
 	free(DATA_PTR(obj));
@@ -4432,7 +4432,7 @@
 	rb_str_cat2(newpath, "/");
 	rb_str_cat2(newpath, p0);
 	path = newpath;
-	p0 = RSTRING_CPTR(path);
+	p0 = RSTRING_PTR(path);
     }
     for (;;) {
 #ifndef S_IWOTH
@@ -4515,7 +4515,7 @@
 rb_find_file_ext(VALUE *filep, const char *const *ext)
 {
     const char *path, *found;
-    const char *f = RSTRING_CPTR(*filep);
+    const char *f = RSTRING_PTR(*filep);
     VALUE fname, load_path;
     long i, j;
 
@@ -4554,8 +4554,8 @@
 	    char fbuf[MAXPATHLEN];
 
 	    FilePathValue(str);
-	    if (RSTRING_CLEN(str) == 0) continue;
-	    path = RSTRING_CPTR(str);
+	    if (RSTRING_LEN(str) == 0) continue;
+	    path = RSTRING_PTR(str);
 	    found = dln_find_file_r(StringValueCStr(fname), path, fbuf, sizeof(fbuf));
 	    if (found && file_load_ok(found)) {
 		*filep = rb_str_new2(found);
@@ -4612,16 +4612,16 @@
 	for (i=0, count=RARRAY_LEN(load_path);i < count;i++) {
 	    VALUE str = RARRAY_AT(load_path, i);
 	    FilePathValue(str);
-	    if (RSTRING_CLEN(str) > 0) {
+	    if (RSTRING_LEN(str) > 0) {
 		rb_ary_push(tmp, str);
 	    }
 	}
 	tmp = rb_ary_join(tmp, rb_str_new2(PATH_SEP));
-	if (RSTRING_CLEN(tmp) == 0) {
+	if (RSTRING_LEN(tmp) == 0) {
 	    lpath = 0;
 	}
 	else {
-	    lpath = RSTRING_CPTR(tmp);
+	    lpath = RSTRING_PTR(tmp);
 	}
     }
     else {

Modified: MacRuby/trunk/hash.c
===================================================================
--- MacRuby/trunk/hash.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/hash.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -1498,7 +1498,7 @@
     VALUE str2;
 
     if (key == Qundef) return ST_CONTINUE;
-    if (RSTRING_CLEN(str) > 1) {
+    if (RSTRING_LEN(str) > 1) {
 	rb_str_cat2(str, ", ");
     }
     str2 = rb_inspect(key);
@@ -2156,8 +2156,8 @@
 
     rb_secure(4);
     SafeStringValue(name);
-    nam = RSTRING_CPTR(name);
-    if (strlen(nam) != RSTRING_CLEN(name)) {
+    nam = RSTRING_PTR(name);
+    if (strlen(nam) != RSTRING_LEN(name)) {
 	rb_raise(rb_eArgError, "bad environment variable name");
     }
     val = getenv(nam);
@@ -2195,8 +2195,8 @@
 
     rb_secure(4);
     SafeStringValue(name);
-    nam = RSTRING_CPTR(name);
-    if (strlen(nam) != RSTRING_CLEN(name)) {
+    nam = RSTRING_PTR(name);
+    if (strlen(nam) != RSTRING_LEN(name)) {
 	rb_raise(rb_eArgError, "bad environment variable name");
     }
     env = getenv(nam);
@@ -2231,8 +2231,8 @@
 	rb_warn("block supersedes default value argument");
     }
     SafeStringValue(key);
-    nam = RSTRING_CPTR(key);
-    if (strlen(nam) != RSTRING_CLEN(key)) {
+    nam = RSTRING_PTR(key);
+    if (strlen(nam) != RSTRING_LEN(key)) {
 	rb_raise(rb_eArgError, "bad environment variable name");
     }
     env = getenv(nam);
@@ -2390,11 +2390,11 @@
     }
     StringValue(nm);
     StringValue(val);
-    name = RSTRING_CPTR(nm);
-    value = RSTRING_CPTR(val);
-    if (strlen(name) != RSTRING_CLEN(nm))
+    name = RSTRING_PTR(nm);
+    value = RSTRING_PTR(val);
+    if (strlen(name) != RSTRING_LEN(nm))
 	rb_raise(rb_eArgError, "bad environment variable name");
-    if (strlen(value) != RSTRING_CLEN(val))
+    if (strlen(value) != RSTRING_LEN(val))
 	rb_raise(rb_eArgError, "bad environment variable value");
 
     ruby_setenv(name, value);
@@ -2698,7 +2698,7 @@
 
     rb_secure(4);
     s = StringValuePtr(key);
-    if (strlen(s) != RSTRING_CLEN(key))
+    if (strlen(s) != RSTRING_LEN(key))
 	rb_raise(rb_eArgError, "bad environment variable name");
     if (getenv(s)) return Qtrue;
     return Qfalse;
@@ -2711,7 +2711,7 @@
 
     rb_secure(4);
     s = StringValuePtr(key);
-    if (strlen(s) != RSTRING_CLEN(key))
+    if (strlen(s) != RSTRING_LEN(key))
 	rb_raise(rb_eArgError, "bad environment variable name");
     e = getenv(s);
     if (e) return rb_assoc_new(key, rb_tainted_str_new2(e));
@@ -2731,7 +2731,7 @@
 	char *s = strchr(*env, '=');
 	if (s++) {
 	    long len = strlen(s);
-	    if (RSTRING_CLEN(obj) == len && strncmp(s, RSTRING_CPTR(obj), len) == 0) {
+	    if (RSTRING_LEN(obj) == len && strncmp(s, RSTRING_PTR(obj), len) == 0) {
 		FREE_ENVIRON(environ);
 		return Qtrue;
 	    }
@@ -2755,7 +2755,7 @@
 	char *s = strchr(*env, '=');
 	if (s++) {
 	    long len = strlen(s);
-	    if (RSTRING_CLEN(obj) == len && strncmp(s, RSTRING_CPTR(obj), len) == 0) {
+	    if (RSTRING_LEN(obj) == len && strncmp(s, RSTRING_PTR(obj), len) == 0) {
 		VALUE result = rb_assoc_new(rb_tainted_str_new(*env, s-*env-1), obj);
 		FREE_ENVIRON(environ);
 		return result;
@@ -2780,7 +2780,7 @@
 	char *s = strchr(*env, '=');
 	if (s++) {
 	    long len = strlen(s);
-	    if (RSTRING_CLEN(value) == len && strncmp(s, RSTRING_CPTR(value), len) == 0) {
+	    if (RSTRING_LEN(value) == len && strncmp(s, RSTRING_PTR(value), len) == 0) {
 		str = env_str_new(*env, s-*env-1);
 		FREE_ENVIRON(environ);
 		return str;
@@ -2837,7 +2837,7 @@
 	char *s = strchr(*env, '=');
 	if (s) {
 	    VALUE key = env_str_new(*env, s-*env);
-	    VALUE val = env_str_new2(getenv(RSTRING_CPTR(key)));
+	    VALUE val = env_str_new2(getenv(RSTRING_PTR(key)));
 	    env_delete(Qnil, key);
 	    return rb_assoc_new(key, val);
 	}

Modified: MacRuby/trunk/include/ruby/ruby.h
===================================================================
--- MacRuby/trunk/include/ruby/ruby.h	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/include/ruby/ruby.h	2008-07-09 23:03:30 UTC (rev 348)
@@ -537,21 +537,21 @@
 #else
 /* IMPORTANT: try to avoid using RSTRING_PTR/RSTRING_LEN if necessary, 
  * because they can be slow operations in non-8bit strings. 
- * If you modify RSTRING_PTR, you need to call RSTRING_SYNC in order to
+ * If you modify RSTRING_BYTEPTR, you need to call RSTRING_SYNC in order to
  * synchronize its content with the real string storage.
- * RSTRING_PTR/RSTRING_LEN deal with bytes. If you want to access a C string
- * pointer, please use RSTRING_CPTR instead which is faster.
+ * RSTRING_BYTEPTR/RSTRING_BYTELEN deal with bytes. If you want to access a C string
+ * pointer, please use RSTRING_PTR/RSTRING/LEN instead which are faster.
  */
 char *rb_str_byteptr(VALUE);
 long rb_str_bytelen(VALUE);
 void rb_str_bytesync(VALUE);
 const char *rb_str_cstr(VALUE);
 long rb_str_clen(VALUE);
-# define RSTRING_PTR(str) (rb_str_byteptr((VALUE)str))
-# define RSTRING_LEN(str) (rb_str_bytelen((VALUE)str))
+# define RSTRING_BYTEPTR(str) (rb_str_byteptr((VALUE)str))
+# define RSTRING_BYTELEN(str) (rb_str_bytelen((VALUE)str))
 # define RSTRING_SYNC(str) (rb_str_bytesync((VALUE)str))
-# define RSTRING_CPTR(str) (rb_str_cstr((VALUE)str))
-# define RSTRING_CLEN(str) (rb_str_clen((VALUE)str))
+# define RSTRING_PTR(str) (rb_str_cstr((VALUE)str))
+# define RSTRING_LEN(str) (rb_str_clen((VALUE)str))
 #endif
 #define RSTRING_END(str) (RSTRING_PTR(str)+RSTRING_LEN(str))
 

Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/io.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -329,7 +329,7 @@
 static void
 io_ungetc(VALUE str, rb_io_t *fptr)
 {
-    int len = RSTRING_LEN(str);
+    int len = RSTRING_BYTELEN(str);
 
     if (fptr->rbuf == NULL) {
         fptr->rbuf_off = 0;
@@ -351,7 +351,7 @@
     }
     fptr->rbuf_off-=len;
     fptr->rbuf_len+=len;
-    MEMMOVE(fptr->rbuf+fptr->rbuf_off, RSTRING_PTR(str), char, len);
+    MEMMOVE(fptr->rbuf+fptr->rbuf_off, RSTRING_BYTEPTR(str), char, len);
 }
 
 static rb_io_t *
@@ -711,7 +711,7 @@
 	}
     }
 
-    len = RSTRING_LEN(str);
+    len = RSTRING_BYTELEN(str);
     if ((n = len) <= 0) return n;
     if (fptr->wbuf == NULL && !(fptr->mode & FMODE_SYNC)) {
         fptr->wbuf_off = 0;
@@ -727,7 +727,7 @@
                 MEMMOVE(fptr->wbuf, fptr->wbuf+fptr->wbuf_off, char, fptr->wbuf_len);
                 fptr->wbuf_off = 0;
             }
-            MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_PTR(str)+offset, char, len);
+            MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_BYTEPTR(str)+offset, char, len);
             fptr->wbuf_len += len;
             n = 0;
         }
@@ -748,7 +748,7 @@
             wsplit_p(fptr)) {
             l = PIPE_BUF;
         }
-	r = rb_write_internal(fptr->fd, RSTRING_PTR(str)+offset, l);
+	r = rb_write_internal(fptr->fd, RSTRING_BYTEPTR(str)+offset, l);
 	/* xxx: other threads may modify given string. */
         if (r == n) return len;
         if (0 <= r) {
@@ -758,7 +758,7 @@
         }
         if (rb_io_wait_writable(fptr->fd)) {
             rb_io_check_closed(fptr);
-	    if (offset < RSTRING_LEN(str))
+	    if (offset < RSTRING_BYTELEN(str))
 		goto retry;
         }
         return -1L;
@@ -769,7 +769,7 @@
             MEMMOVE(fptr->wbuf, fptr->wbuf+fptr->wbuf_off, char, fptr->wbuf_len);
         fptr->wbuf_off = 0;
     }
-    MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_PTR(str)+offset, char, len);
+    MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_BYTEPTR(str)+offset, char, len);
     fptr->wbuf_len += len;
     return len;
 }
@@ -820,7 +820,7 @@
 	return rb_funcall(io, id_write, 1, str);
     }
     io = tmp;
-    if (RSTRING_CLEN(str) == 0) return INT2FIX(0);
+    if (RSTRING_LEN(str) == 0) return INT2FIX(0);
 
     GetOpenFile(io, fptr);
     rb_io_check_writable(fptr);
@@ -1297,10 +1297,10 @@
 static long
 io_fread(VALUE str, long offset, rb_io_t *fptr)
 {
-    long len = RSTRING_LEN(str) - offset;
+    long len = RSTRING_BYTELEN(str) - offset;
     long n = len;
     int c;
-    char *ptr = RSTRING_PTR(str);
+    char *ptr = RSTRING_BYTEPTR(str);
 
     while (n > 0) {
 	c = read_buffered_data(ptr+offset, n, fptr);
@@ -1329,7 +1329,7 @@
     of.mode = FMODE_READABLE;
     str = rb_str_new(ptr, len);
     n = io_fread(str, 0, &of);
-    MEMCPY(ptr, RSTRING_PTR(str), char, n);
+    MEMCPY(ptr, RSTRING_BYTEPTR(str), char, n);
     RSTRING_SYNC(str);
     return n;
 }
@@ -1411,7 +1411,7 @@
 	bytes += n;
 #if !WITH_OBJC
 	if (cr != ENC_CODERANGE_BROKEN)
-	    pos = rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + bytes, enc, &cr);
+	    pos = rb_str_coderange_scan_restartable(RSTRING_BYTEPTR(str) + pos, RSTRING_BYTEPTR(str) + bytes, enc, &cr);
 #endif
 	if (bytes < siz) break;
 	siz += BUFSIZ;
@@ -1479,20 +1479,20 @@
 
     if (!nonblock)
         READ_CHECK(fptr);
-    if (RSTRING_LEN(str) != len) {
+    if (RSTRING_BYTELEN(str) != len) {
       modified:
 	rb_raise(rb_eRuntimeError, "buffer string modified");
     }
-    n = read_buffered_data(RSTRING_PTR(str), len, fptr);
+    n = read_buffered_data(RSTRING_BYTEPTR(str), len, fptr);
     if (n <= 0) {
       again:
-	if (RSTRING_LEN(str) != len) goto modified;
+	if (RSTRING_BYTELEN(str) != len) goto modified;
         if (nonblock) {
             rb_io_set_nonblock(fptr);
-	    n = rb_read_internal(fptr->fd, RSTRING_PTR(str), len);
+	    n = rb_read_internal(fptr->fd, RSTRING_BYTEPTR(str), len);
         }
         else {
-            n = rb_read_internal(fptr->fd, RSTRING_PTR(str), len);
+            n = rb_read_internal(fptr->fd, RSTRING_BYTEPTR(str), len);
 	}
         if (n < 0) {
             if (!nonblock && rb_io_wait_readable(fptr->fd))
@@ -1648,7 +1648,7 @@
     io_fflush(fptr);
 
     rb_io_set_nonblock(fptr);
-    n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
+    n = write(fptr->fd, RSTRING_BYTEPTR(str), RSTRING_BYTELEN(str));
 
     if (n == -1) rb_sys_fail(fptr->path);
 
@@ -1711,7 +1711,7 @@
     if (len == 0) return str;
 
     READ_CHECK(fptr);
-    if (RSTRING_LEN(str) != len) {
+    if (RSTRING_BYTELEN(str) != len) {
 	rb_raise(rb_eRuntimeError, "buffer string modified");
     }
     n = io_fread(str, 0, fptr);
@@ -1730,7 +1730,7 @@
 rscheck(const char *rsptr, long rslen, VALUE rs)
 {
     if (!rs) return;
-    if (RSTRING_PTR(rs) != rsptr && RSTRING_LEN(rs) != rslen)
+    if (RSTRING_BYTEPTR(rs) != rsptr && RSTRING_BYTELEN(rs) != rslen)
 	rb_raise(rb_eRuntimeError, "rs modified");
 }
 
@@ -1756,7 +1756,7 @@
 	    if (e) pending = e - p + 1;
 	    len += pending;
 	    if (!NIL_P(str)) {
-		last = RSTRING_LEN(str);
+		last = RSTRING_BYTELEN(str);
 		rb_str_resize(str, last + len);
 	    }
 	    else {
@@ -1764,7 +1764,7 @@
 		rb_str_set_len(str, len);
 	    }
 	    if (c != EOF) {
-		RSTRING_PTR(str)[last++] = c;
+		RSTRING_BYTEPTR(str)[last++] = c;
 	    }
 	    if (limit > 0 && limit == pending) {
 #if !WITH_OBJC
@@ -1776,14 +1776,14 @@
 		    int diff = pp - pl;
 		    pending -= diff;
 		    limit = pending;
-		    rb_str_set_len(str, RSTRING_LEN(str)-diff);
+		    rb_str_set_len(str, RSTRING_BYTELEN(str)-diff);
 		}
 #endif
 	    }
-	    read_buffered_data(RSTRING_PTR(str) + last, pending, fptr); /* must not fail */
+	    read_buffered_data(RSTRING_BYTEPTR(str) + last, pending, fptr); /* must not fail */
 	    limit -= pending;
 	    *lp = limit;
-	    if (limit == 0) return RSTRING_PTR(str)[RSTRING_LEN(str)-1];
+	    if (limit == 0) return RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)-1];
 	    if (e) return delim;
 	}
 	else if (c != EOF) {
@@ -1794,7 +1794,7 @@
 	    else {
 		*strp = str = rb_str_buf_new(1);
 		rb_str_resize(str, 1);
-		RSTRING_PTR(str)[0] = c;
+		RSTRING_BYTEPTR(str)[0] = c;
 	    }
 	}
 	rb_thread_wait_fd(fptr->fd);
@@ -1876,12 +1876,12 @@
 	    }
 	    else {
 		rb_str_resize(str, len + pending);
-		read_buffered_data(RSTRING_PTR(str)+len, pending, fptr);
+		read_buffered_data(RSTRING_BYTEPTR(str)+len, pending, fptr);
 	    }
 	    len += pending;
 #if !WITH_OBJC
 	    if (cr != ENC_CODERANGE_BROKEN)
-		pos = rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + len, enc, &cr);
+		pos = rb_str_coderange_scan_restartable(RSTRING_BYTEPTR(str) + pos, RSTRING_BYTEPTR(str) + len, enc, &cr);
 #endif
 	    if (e) break;
 	}
@@ -1977,7 +1977,7 @@
     enc = io_input_encoding(fptr);
     if (NIL_P(rs)) {
 	str = read_all(fptr, 0, Qnil);
-	if (RSTRING_LEN(str) == 0) return Qnil;
+	if (RSTRING_BYTELEN(str) == 0) return Qnil;
     }
     else if (limit == 0) {
 	return rb_enc_str_new(0, 0, io_read_encoding(fptr));
@@ -1996,7 +1996,7 @@
 	long rslen;
 	int rspara = 0;
 
-	rslen = RSTRING_LEN(rs);
+	rslen = RSTRING_BYTELEN(rs);
 	if (rslen == 0) {
 	    rsptr = "\n\n";
 	    rslen = 2;
@@ -2005,7 +2005,7 @@
 	    rs = 0;
 	}
 	else {
-	    rsptr = RSTRING_PTR(rs);
+	    rsptr = RSTRING_BYTEPTR(rs);
 	}
 	newline = rsptr[rslen - 1];
 
@@ -2013,9 +2013,9 @@
 	    if (c == newline) {
 		const char *s, *p;
 
-		if (RSTRING_LEN(str) < rslen) continue;
-		s = RSTRING_PTR(str);
-		p = s +  RSTRING_LEN(str) - rslen;
+		if (RSTRING_BYTELEN(str) < rslen) continue;
+		s = RSTRING_BYTEPTR(str);
+		p = s +  RSTRING_BYTELEN(str) - rslen;
 #if !WITH_OBJC
 		pp = rb_enc_left_char_head(s, p, enc);
 		if (pp != p) continue;
@@ -2328,7 +2328,7 @@
 		rb_str_cat(str, fptr->rbuf+fptr->rbuf_off, 1);
 		fptr->rbuf_off++;
 		fptr->rbuf_len--;
-		r = rb_enc_precise_mbclen(RSTRING_PTR(str), RSTRING_PTR(str)+RSTRING_LEN(str), enc);
+		r = rb_enc_precise_mbclen(RSTRING_BYTEPTR(str), RSTRING_BYTEPTR(str)+RSTRING_BYTELEN(str), enc);
 		if (MBCLEN_NEEDMORE_P(r)) {
 		    goto getc_needmore;
 		}
@@ -3088,7 +3088,7 @@
         rb_io_check_closed(fptr);
     }
     TRAP_BEG;
-    n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
+    n = write(fptr->fd, RSTRING_BYTEPTR(str), RSTRING_BYTELEN(str));
     TRAP_END;
 
     if (n == -1) rb_sys_fail(fptr->path);
@@ -3142,11 +3142,11 @@
     n = fptr->fd;
     rb_thread_wait_fd(fptr->fd);
     rb_io_check_closed(fptr);
-    if (RSTRING_LEN(str) != ilen) {
+    if (RSTRING_BYTELEN(str) != ilen) {
 	rb_raise(rb_eRuntimeError, "buffer string modified");
     }
 
-    n = rb_read_internal(fptr->fd, RSTRING_PTR(str), ilen);
+    n = rb_read_internal(fptr->fd, RSTRING_BYTEPTR(str), ilen);
 
     if (n == -1) {
 	rb_sys_fail(fptr->path);
@@ -3910,14 +3910,14 @@
 	    rb_raise(rb_eArgError, "too many arguments");
 	}
 	argbuf = rb_str_tmp_new((argc+1) * sizeof(char *));
-	args = (void *)RSTRING_PTR(argbuf);
+	args = (void *)RSTRING_BYTEPTR(argbuf);
 	for (i = 0; i < argc; ++i) {
 	    args[i] = StringValueCStr(argv[i]);
 	}
 	args[i] = NULL;
 	exename = cmd;
 	cmdbuf = rb_str_tmp_new(rb_w32_argv_size(args));
-	cmd = rb_w32_join_argv(RSTRING_PTR(cmdbuf), args);
+	cmd = rb_w32_join_argv(RSTRING_BYTEPTR(cmdbuf), args);
 	rb_str_resize(argbuf, 0);
     }
     if (eargp) {
@@ -3954,7 +3954,7 @@
     fp = popen(cmd, mode);
     if (eargp)
 	rb_run_exec_options(&sarg, NULL);
-    if (!fp) rb_sys_fail(RSTRING_PTR(prog));
+    if (!fp) rb_sys_fail(RSTRING_BYTEPTR(prog));
     fd = fileno(fp);
 #endif
 
@@ -3995,12 +3995,12 @@
 static VALUE
 pipe_open_s(VALUE prog, const char *mode)
 {
-    const char *cmd = RSTRING_CPTR(prog);
+    const char *cmd = RSTRING_PTR(prog);
     int argc = 1;
     VALUE *argv = &prog;
     struct rb_exec_arg earg;
 
-    if (RSTRING_CLEN(prog) == 1 && cmd[0] == '-') {
+    if (RSTRING_LEN(prog) == 1 && cmd[0] == '-') {
 #if !defined(HAVE_FORK)
 	rb_raise(rb_eNotImpError,
 		 "fork() function is unimplemented on this machine");
@@ -4132,12 +4132,12 @@
 	}
 	fmode = NIL_P(perm) ? 0666 :  NUM2INT(perm);
 
-	rb_file_sysopen_internal(io, RSTRING_PTR(fname), flags, fmode);
+	rb_file_sysopen_internal(io, RSTRING_BYTEPTR(fname), flags, fmode);
     }
     else {
 
 	mode = NIL_P(vmode) ? "r" : StringValueCStr(vmode);
-	rb_file_open_internal(io, RSTRING_PTR(fname), mode);
+	rb_file_open_internal(io, RSTRING_BYTEPTR(fname), mode);
     }
     return io;
 }
@@ -4198,7 +4198,7 @@
     else             fmode = NUM2INT(perm);
 
     RB_GC_GUARD(fname) = rb_str_new4(fname);
-    path = RSTRING_PTR(fname);
+    path = RSTRING_BYTEPTR(fname);
     fd = rb_sysopen(path, flags, fmode);
     return INT2NUM(fd);
 }
@@ -4330,7 +4330,7 @@
 	    else {
 		char *str = StringValuePtr(tmp);
 		if (str && str[0] == '|') {
-		    argv[0] = rb_str_new(str+1, RSTRING_LEN(tmp)-1);
+		    argv[0] = rb_str_new(str+1, RSTRING_BYTELEN(tmp)-1);
 		    OBJ_INFECT(argv[0], tmp);
 		    return rb_io_s_popen(argc, argv, rb_cIO);
 		}
@@ -4817,8 +4817,8 @@
 	}
 	line = rb_obj_as_string(argv[i]);
 	rb_io_write(out, line);
-	if (RSTRING_LEN(line) == 0 ||
-            RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') {
+	if (RSTRING_BYTELEN(line) == 0 ||
+            RSTRING_BYTEPTR(line)[RSTRING_BYTELEN(line)-1] != '\n') {
 	    rb_io_write(out, rb_default_rs);
 	}
     }
@@ -5085,7 +5085,7 @@
 		    rb_raise(rb_eArgError, "incompatible mode 0%o", flags);
 		}
 		else {
-		    rb_raise(rb_eArgError, "incompatible mode \"%s\"", RSTRING_PTR(mode));
+		    rb_raise(rb_eArgError, "incompatible mode \"%s\"", RSTRING_BYTEPTR(mode));
 		}
 	    }
 	}
@@ -5356,13 +5356,13 @@
 #endif
 #ifdef NO_SAFE_RENAME
 			(void)close(fr);
-			(void)unlink(RSTRING_PTR(str));
-			(void)rename(fn, RSTRING_PTR(str));
-			fr = rb_sysopen(RSTRING_PTR(str), O_RDONLY, 0);
+			(void)unlink(RSTRING_BYTEPTR(str));
+			(void)rename(fn, RSTRING_BYTEPTR(str));
+			fr = rb_sysopen(RSTRING_BYTEPTR(str), O_RDONLY, 0);
 #else
-			if (rename(fn, RSTRING_PTR(str)) < 0) {
+			if (rename(fn, RSTRING_BYTEPTR(str)) < 0) {
 			    rb_warn("Can't rename %s to %s: %s, skipping file",
-				    fn, RSTRING_PTR(str), strerror(errno));
+				    fn, RSTRING_BYTEPTR(str), strerror(errno));
 			    close(fr);
 			    goto retry;
 			}
@@ -5915,20 +5915,20 @@
 #endif
 	    rb_str_modify(arg);
 
-	    if (len <= RSTRING_LEN(arg)) {
-		len = RSTRING_LEN(arg);
+	    if (len <= RSTRING_BYTELEN(arg)) {
+		len = RSTRING_BYTELEN(arg);
 	    }
-	    if (RSTRING_LEN(arg) < len) {
+	    if (RSTRING_BYTELEN(arg) < len) {
 		rb_str_resize(arg, len+1);
 	    }
-	    RSTRING_PTR(arg)[len] = 17;	/* a little sanity check here */
-	    narg = (long)RSTRING_PTR(arg);
+	    RSTRING_BYTEPTR(arg)[len] = 17;	/* a little sanity check here */
+	    narg = (long)RSTRING_BYTEPTR(arg);
 	}
     }
     GetOpenFile(io, fptr);
     retval = io_cntl(fptr->fd, cmd, narg, io_p);
     if (retval < 0) rb_sys_fail(fptr->path);
-    if (TYPE(arg) == T_STRING && RSTRING_PTR(arg)[len] != 17) {
+    if (TYPE(arg) == T_STRING && RSTRING_BYTEPTR(arg)[len] != 17) {
 	rb_raise(rb_eArgError, "return value overflowed string");
     }
 
@@ -6256,7 +6256,7 @@
     arg->argv = argv + 1;
     if (argc == 1) {
       no_key:
-	arg->io = rb_io_open(RSTRING_PTR(argv[0]), "r");
+	arg->io = rb_io_open(RSTRING_BYTEPTR(argv[0]), "r");
 	return;
     }
     opt = rb_check_convert_type(argv[argc-1], T_HASH, "Hash", "to_hash");
@@ -6295,10 +6295,10 @@
     }
     v = rb_hash_aref(opt, mode);
     if (!NIL_P(v)) {
-	arg->io = rb_io_open(RSTRING_PTR(argv[0]), StringValueCStr(v));
+	arg->io = rb_io_open(RSTRING_BYTEPTR(argv[0]), StringValueCStr(v));
     }
     else {
-	arg->io = rb_io_open(RSTRING_PTR(argv[0]), "r");
+	arg->io = rb_io_open(RSTRING_BYTEPTR(argv[0]), "r");
     }
 
     v = rb_hash_aref(opt, encoding);
@@ -6761,7 +6761,7 @@
             ssize_t ss;
             rb_thread_wait_fd(stp->src_fd);
             rb_str_resize(buf, buflen);
-            ss = copy_stream_read(stp, RSTRING_PTR(buf), l, off);
+            ss = copy_stream_read(stp, RSTRING_BYTEPTR(buf), l, off);
             if (ss == -1)
                 return Qnil;
             if (ss == 0)
@@ -6872,7 +6872,7 @@
         }
         str = rb_str_buf_new(len);
         rb_str_resize(str,len);
-        read_buffered_data(RSTRING_PTR(str), len, src_fptr);
+        read_buffered_data(RSTRING_BYTEPTR(str), len, src_fptr);
         if (dst_fptr) /* IO or filename */
             io_fwrite(str, dst_fptr);
         else /* others such as StringIO */
@@ -7190,8 +7190,8 @@
 	}
     }
     else if (argc >= 1) {
-	if (RSTRING_LEN(str) < len) {
-	    len -= RSTRING_LEN(str);
+	if (RSTRING_BYTELEN(str) < len) {
+	    len -= RSTRING_BYTELEN(str);
 	    argv[0] = INT2NUM(len);
 	    goto retry;
 	}
@@ -7457,7 +7457,7 @@
 	StringValue(val);
 	if (ruby_inplace_mode) free(ruby_inplace_mode);
 	ruby_inplace_mode = 0;
-	ruby_inplace_mode = strdup(RSTRING_PTR(val));
+	ruby_inplace_mode = strdup(RSTRING_BYTEPTR(val));
     }
     return argf;
 }

Modified: MacRuby/trunk/iseq.c
===================================================================
--- MacRuby/trunk/iseq.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/iseq.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -49,8 +49,8 @@
     if (ptr) {
 	iseq = ptr;
 	/* It's possible that strings are freed
-         * GC_INFO("%s @ %s\n", RSTRING_CPTR(iseq->name),
-         *                      RSTRING_CPTR(iseq->filename));
+         * GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->name),
+         *                      RSTRING_PTR(iseq->filename));
 	 */
 	if (iseq->iseq != iseq->iseq_encoded) {
 	    RUBY_FREE_UNLESS_NULL(iseq->iseq_encoded);
@@ -75,7 +75,7 @@
 
     if (ptr) {
 	iseq = ptr;
-	RUBY_GC_INFO("%s @ %s\n", RSTRING_CPTR(iseq->name), RSTRING_CPTR(iseq->filename));
+	RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->name), RSTRING_PTR(iseq->filename));
 	RUBY_MARK_UNLESS_NULL(iseq->mark_ary);
 	RUBY_MARK_UNLESS_NULL(iseq->name);
 	RUBY_MARK_UNLESS_NULL(iseq->filename);
@@ -543,7 +543,7 @@
     rb_iseq_t *iseq = iseq_check(self);
 
     snprintf(buff, sizeof(buff), "<ISeq:%s@%s>",
-	     RSTRING_CPTR(iseq->name), RSTRING_CPTR(iseq->filename));
+	     RSTRING_PTR(iseq->name), RSTRING_PTR(iseq->filename));
 
     return rb_str_new2(buff);
 }
@@ -756,7 +756,7 @@
 	int line_no = find_line_no(iseqdat, pos);
 	int prev = find_prev_line_no(iseqdat, pos);
 	if (line_no && line_no != prev) {
-	    snprintf(buff, sizeof(buff), "%-70s(%4d)", RSTRING_CPTR(str),
+	    snprintf(buff, sizeof(buff), "%-70s(%4d)", RSTRING_PTR(str),
 		     line_no);
 	    str = rb_str_new2(buff);
 	}
@@ -765,7 +765,7 @@
 	/* for debug */
 	struct iseq_insn_info_entry *entry = get_insn_info(iseqdat, pos);
 	snprintf(buff, sizeof(buff), "%-60s(line: %d, sp: %d)",
-		 RSTRING_CPTR(str), entry->line_no, entry->sp);
+		 RSTRING_PTR(str), entry->line_no, entry->sp);
 	str = rb_str_new2(buff);
     }
 
@@ -774,7 +774,7 @@
 	rb_str_concat(ret, str);
     }
     else {
-	printf("%s\n", RSTRING_CPTR(str));
+	printf("%s\n", RSTRING_PTR(str));
     }
     return len;
 }
@@ -822,9 +822,9 @@
     rb_str_cat2(str, "== disasm: ");
 
     rb_str_concat(str, iseq_inspect(iseqdat->self));
-    if ((i = RSTRING_CLEN(str)) < header_minlen) {
+    if ((i = RSTRING_LEN(str)) < header_minlen) {
 	rb_str_resize(str, header_minlen);
-	memset(RSTRING_PTR(str) + i, '=', header_minlen - i);
+	memset(RSTRING_BYTEPTR(str) + i, '=', header_minlen - i);
 	RSTRING_SYNC(str);
     }
     rb_str_cat2(str, "\n");

Modified: MacRuby/trunk/load.c
===================================================================
--- MacRuby/trunk/load.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/load.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -63,7 +63,7 @@
     for (i = 0; i < RARRAY_LEN(load_path); ++i) {
 	VALUE p = RARRAY_AT(load_path, i);
 	const char *s = StringValuePtr(p);
-	long n = RSTRING_CLEN(p);
+	long n = RSTRING_LEN(p);
 
 	if (vlen < n + len + 1) continue;
 	if (n && (strncmp(name, s, n) || name[n] != '/')) continue;
@@ -128,13 +128,13 @@
     for (i = 0, count = RARRAY_LEN(features); i < count; ++i) {
 	v = RARRAY_AT(features, i);
 	f = StringValueCStr(v);
-	if ((n = RSTRING_CLEN(v)) < len) continue;
+	if ((n = RSTRING_LEN(v)) < len) continue;
 	if (strncmp(f, feature, len) != 0) {
 	    if (expanded) continue;
 	    if (!load_path) load_path = rb_get_load_path();
 	    if (!(p = loaded_feature_path(f, n, feature, len, type, load_path)))
 		continue;
-	    f += RSTRING_CLEN(p) + 1;
+	    f += RSTRING_LEN(p) + 1;
 	}
 	if (!*(e = f + len)) {
 	    if (ext) continue;
@@ -176,7 +176,7 @@
 
 	    if (ext && *ext) return 0;
 	    bufstr = rb_str_tmp_new(len + DLEXT_MAXLEN);
-	    buf = RSTRING_PTR(bufstr); /* ok */
+	    buf = RSTRING_BYTEPTR(bufstr); /* ok */
 	    MEMCPY(buf, feature, char, len);
 	    for (i = 0; (e = loadable_ext[i]) != 0; i++) {
 		strncpy(buf + len, e, DLEXT_MAXLEN + 1);
@@ -201,7 +201,7 @@
     if (*feature == '.' &&
 	(feature[1] == '/' || strncmp(feature+1, "./", 2) == 0)) {
 	fullpath = rb_file_expand_path(rb_str_new2(feature), Qnil);
-	feature = RSTRING_CPTR(fullpath);
+	feature = RSTRING_PTR(fullpath);
     }
     if (ext && !strchr(ext, '/')) {
 	if (IS_RBEXT(ext)) {
@@ -275,7 +275,7 @@
 	VALUE iseq;
 
 	th->parse_in_eval++;
-	node = (NODE *)rb_load_file(RSTRING_CPTR(fname));
+	node = (NODE *)rb_load_file(RSTRING_PTR(fname));
 	th->parse_in_eval--;
 	loaded = Qtrue;
 	iseq = rb_iseq_new(node, rb_str_new2("<top (required)>"),
@@ -416,7 +416,7 @@
     const char *loading;
 
     *path = 0;
-    ext = strrchr(ftptr = RSTRING_CPTR(fname), '.');
+    ext = strrchr(ftptr = RSTRING_PTR(fname), '.');
     if (ext && !strchr(ext, '/')) {
 	if (IS_RBEXT(ext)) {
 	    if (rb_feature_p(ftptr, ext, Qtrue, Qfalse, &loading)) {
@@ -425,7 +425,7 @@
 	    }
 	    if ((tmp = rb_find_file(fname)) != 0) {
 		tmp = rb_file_expand_path(tmp, Qnil);
-		ext = strrchr(ftptr = RSTRING_CPTR(tmp), '.');
+		ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
 		if (!rb_feature_p(ftptr, ext, Qtrue, Qtrue, 0))
 		    *path = tmp;
 		return 'r';
@@ -437,12 +437,12 @@
 		if (loading) *path = rb_str_new2(loading);
 		return 's';
 	    }
-	    tmp = rb_str_new(RSTRING_CPTR(fname), ext - RSTRING_CPTR(fname));
+	    tmp = rb_str_new(RSTRING_PTR(fname), ext - RSTRING_PTR(fname));
 #ifdef DLEXT2
 	    OBJ_FREEZE(tmp);
 	    if (rb_find_file_ext(&tmp, loadable_ext + 1)) {
 		tmp = rb_file_expand_path(tmp, Qnil);
-		ext = strrchr(ftptr = RSTRING_CPTR(tmp), '.');
+		ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
 		if (!rb_feature_p(ftptr, ext, Qfalse, Qtrue, 0))
 		    *path = tmp;
 		return 's';
@@ -452,7 +452,7 @@
 	    OBJ_FREEZE(tmp);
 	    if ((tmp = rb_find_file(tmp)) != 0) {
 		tmp = rb_file_expand_path(tmp, Qnil);
-		ext = strrchr(ftptr = RSTRING_CPTR(tmp), '.');
+		ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
 		if (!rb_feature_p(ftptr, ext, Qfalse, Qtrue, 0))
 		    *path = tmp;
 		return 's';
@@ -466,7 +466,7 @@
 	    }
 	    if ((tmp = rb_find_file(fname)) != 0) {
 		tmp = rb_file_expand_path(tmp, Qnil);
-		ext = strrchr(ftptr = RSTRING_CPTR(tmp), '.');
+		ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
 		if (!rb_feature_p(ftptr, ext, Qfalse, Qtrue, 0))
 		    *path = tmp;
 		return 's';
@@ -484,14 +484,14 @@
       case 0:
 	if (ft)
 	    break;
-	ftptr = RSTRING_CPTR(tmp);
+	ftptr = RSTRING_PTR(tmp);
 	return rb_feature_p(ftptr, 0, Qfalse, Qtrue, 0);
 
       default:
 	if (ft)
 	    break;
       case 1:
-	ext = strrchr(ftptr = RSTRING_CPTR(tmp), '.');
+	ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
 	if (rb_feature_p(ftptr, ext, !--type, Qtrue, &loading) && !loading)
 	    break;
 	*path = tmp;
@@ -503,14 +503,14 @@
 load_failed(VALUE fname)
 {
     rb_raise(rb_eLoadError, "no such file to load -- %s",
-	     RSTRING_CPTR(fname));
+	     RSTRING_PTR(fname));
 }
 
 static VALUE
 load_ext(VALUE path)
 {
     SCOPE_SET(NOEX_PUBLIC);
-    return (VALUE)dln_load(RSTRING_CPTR(path));
+    return (VALUE)dln_load(RSTRING_PTR(path));
 }
 
 VALUE
@@ -537,7 +537,7 @@
 	RB_GC_GUARD(fname) = rb_str_new4(fname);
 	found = search_required(fname, &path);
 	if (found) {
-	    if (!path || !(ftptr = load_lock(RSTRING_CPTR(path)))) {
+	    if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
 		result = Qfalse;
 	    }
 	    else {
@@ -622,7 +622,7 @@
     ID id = rb_to_id(sym);
 
     Check_SafeStr(file);
-    rb_autoload(mod, id, RSTRING_CPTR(file));
+    rb_autoload(mod, id, RSTRING_PTR(file));
     return Qnil;
 }
 

Modified: MacRuby/trunk/marshal.c
===================================================================
--- MacRuby/trunk/marshal.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/marshal.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -174,7 +174,7 @@
 class2path(VALUE klass)
 {
     VALUE path = rb_class_path(klass);
-    const char *n = RSTRING_CPTR(path);
+    const char *n = RSTRING_PTR(path);
 
     if (n[0] == '#') {
 	rb_raise(rb_eTypeError, "can't dump anonymous %s %s",
@@ -194,7 +194,7 @@
 {
     VALUE buf = arg->str;
     rb_str_buf_cat(buf, s, n);
-    if (arg->dest && RSTRING_CLEN(buf) >= BUFSIZ) {
+    if (arg->dest && RSTRING_LEN(buf) >= BUFSIZ) {
 	if (arg->taint) OBJ_TAINT(buf);
 	rb_io_write(arg->dest, buf);
 	rb_str_resize(buf, 0);
@@ -450,7 +450,7 @@
     w_extended(klass, arg, check);
     w_byte(type, arg);
     p = class2path(rb_class_real(klass));
-    path = RSTRING_CPTR(p);
+    path = RSTRING_PTR(p);
     w_unique(path, arg);
 }
 
@@ -471,7 +471,7 @@
     if (klass != super) {
 #endif
 	w_byte(TYPE_UCLASS, arg);
-	w_unique(RSTRING_CPTR(class2path(klass)), arg);
+	w_unique(RSTRING_PTR(class2path(klass)), arg);
     }
 }
 
@@ -636,7 +636,7 @@
 		w_byte(TYPE_IVAR, arg);
 	    }
 	    w_class(TYPE_USERDEF, obj, arg, Qfalse);
-	    w_bytes(RSTRING_CPTR(v), RSTRING_CLEN(v), arg);
+	    w_bytes(RSTRING_PTR(v), RSTRING_LEN(v), arg);
             if (hasiv2) {
 		w_ivar(v, ivtbl2, &c_arg);
             }
@@ -673,7 +673,7 @@
 	    w_byte(TYPE_CLASS, arg);
 	    {
 		volatile VALUE path = class2path(obj);
-		w_bytes(RSTRING_CPTR(path), RSTRING_CLEN(path), arg);
+		w_bytes(RSTRING_PTR(path), RSTRING_LEN(path), arg);
 	    }
 	    break;
 
@@ -681,7 +681,7 @@
 	    w_byte(TYPE_MODULE, arg);
 	    {
 		VALUE path = class2path(obj);
-		w_bytes(RSTRING_CPTR(path), RSTRING_CLEN(path), arg);
+		w_bytes(RSTRING_PTR(path), RSTRING_LEN(path), arg);
 	    }
 	    break;
 
@@ -724,7 +724,7 @@
 	    w_uclass(obj, rb_cString, arg);
 #endif
 	    w_byte(TYPE_STRING, arg);
-	    w_bytes(RSTRING_CPTR(obj), RSTRING_CLEN(obj), arg);
+	    w_bytes(RSTRING_PTR(obj), RSTRING_LEN(obj), arg);
 	    break;
 
 	  case T_REGEXP:
@@ -927,7 +927,7 @@
 	arg.str = port;
     }
 
-    RSTRING_PTR(arg.str); /* force bytestring creation */
+    RSTRING_BYTEPTR(arg.str); /* force bytestring creation */
 
     arg.symbols = st_init_numtable();
     arg.data    = st_init_numtable();
@@ -976,8 +976,8 @@
     int c;
 
     if (TYPE(arg->src) == T_STRING) {
-	if (RSTRING_CLEN(arg->src) > arg->offset) {
-	    c = (unsigned char)RSTRING_CPTR(arg->src)[arg->offset++];
+	if (RSTRING_LEN(arg->src) > arg->offset) {
+	    c = (unsigned char)RSTRING_PTR(arg->src)[arg->offset++];
 	}
 	else {
 	    rb_raise(rb_eArgError, "marshal data too short");
@@ -1050,8 +1050,8 @@
 
     if (len == 0) return rb_str_new(0, 0);
     if (TYPE(arg->src) == T_STRING) {
-	if (RSTRING_CLEN(arg->src) - arg->offset >= len) {
-	    str = rb_str_new(RSTRING_CPTR(arg->src)+arg->offset, len);
+	if (RSTRING_LEN(arg->src) - arg->offset >= len) {
+	    str = rb_str_new(RSTRING_PTR(arg->src)+arg->offset, len);
 	    arg->offset += len;
 	}
 	else {
@@ -1066,7 +1066,7 @@
 	check_load_arg(arg);
 	if (NIL_P(str)) goto too_short;
 	StringValue(str);
-	if (RSTRING_CLEN(str) != len) goto too_short;
+	if (RSTRING_LEN(str) != len) goto too_short;
 	if (OBJ_TAINTED(str)) arg->taint = Qtrue;
     }
     return str;
@@ -1088,7 +1088,7 @@
 r_symreal(struct load_arg *arg)
 {
     volatile VALUE s = r_bytes(arg);
-    ID id = rb_intern(RSTRING_CPTR(s));
+    ID id = rb_intern(RSTRING_PTR(s));
 
     st_insert(arg->symbols, arg->symbols->num_entries, id);
 
@@ -1331,7 +1331,7 @@
 	{
 	    double d, t = 0.0;
 	    VALUE str = r_bytes(arg);
-	    const char *ptr = RSTRING_CPTR(str);
+	    const char *ptr = RSTRING_PTR(str);
 
 	    if (strcmp(ptr, "nan") == 0) {
 		d = t / t;
@@ -1370,7 +1370,7 @@
             rb_big_resize((VALUE)big, (len + 1) * 2 / sizeof(BDIGIT));
 #endif
             digits = RBIGNUM_DIGITS(big);
-	    MEMCPY(digits, RSTRING_CPTR(data), char, len * 2);
+	    MEMCPY(digits, RSTRING_PTR(data), char, len * 2);
 #if SIZEOF_BDIGITS > SIZEOF_SHORT
 	    MEMZERO((char *)digits + len * 2, char,
 		    RBIGNUM_LEN(big) * sizeof(BDIGIT) - len * 2);
@@ -1577,7 +1577,7 @@
         {
 	    volatile VALUE str = r_bytes(arg);
 
-	    v = rb_path2class(RSTRING_CPTR(str));
+	    v = rb_path2class(RSTRING_PTR(str));
 	    v = r_entry(v, arg);
             v = r_leave(v, arg);
 	}
@@ -1587,7 +1587,7 @@
         {
 	    volatile VALUE str = r_bytes(arg);
 
-	    v = path2class(RSTRING_CPTR(str));
+	    v = path2class(RSTRING_PTR(str));
 	    v = r_entry(v, arg);
             v = r_leave(v, arg);
 	}
@@ -1597,7 +1597,7 @@
         {
 	    volatile VALUE str = r_bytes(arg);
 
-	    v = path2module(RSTRING_CPTR(str));
+	    v = path2module(RSTRING_PTR(str));
 	    v = r_entry(v, arg);
             v = r_leave(v, arg);
 	}

Modified: MacRuby/trunk/numeric.c
===================================================================
--- MacRuby/trunk/numeric.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/numeric.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -134,7 +134,7 @@
 
     rb_raise(rb_eTypeError, "%s can't be coerced into %s",
 	     rb_special_const_p(x[1])?
-	     RSTRING_PTR(v):
+	     RSTRING_BYTEPTR(v):
 	     rb_obj_classname(x[1]),
 	     rb_obj_classname(x[0]));
     return Qnil;		/* dummy */
@@ -1906,7 +1906,7 @@
     if (!enc) enc = rb_ascii8bit_encoding();
     if (i < 0 || (n = rb_enc_codelen(i, enc)) <= 0) goto out_of_range;
     str = rb_enc_str_new(0, n, enc);
-    rb_enc_mbcput(i, RSTRING_PTR(str), enc);
+    rb_enc_mbcput(i, RSTRING_BYTEPTR(str), enc);
 #endif
     return str;
 }

Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/objc.m	2008-07-09 23:03:30 UTC (rev 348)
@@ -642,7 +642,7 @@
 	    rb_raise(rb_eArgError, 
 		    "not enough elements in array `%s' to create " \
 		    "structure `%s' (%ld for %d)", 
-		    RSTRING_CPTR(rb_inspect(rval)), bs_struct->name, n, 
+		    RSTRING_PTR(rb_inspect(rval)), bs_struct->name, n, 
 		    bs_struct->fields_count);
 
 	if (n > bs_struct->fields_count) {
@@ -656,7 +656,7 @@
 		rb_raise(rb_eArgError, 
 			"too much elements in array `%s' to create " \
 			"structure `%s' (%ld for %d)", 
-			RSTRING_CPTR(rb_inspect(orig)), 
+			RSTRING_PTR(rb_inspect(orig)), 
 			bs_struct->name, RARRAY_LEN(orig), 
 			bs_struct->fields_count);
 	    }
@@ -778,8 +778,8 @@
 	    break;
 
 	case _C_CHR:
-	    if (TYPE(rval) == T_STRING && RSTRING_CLEN(rval) == 1) {
-		*(char *)ocval = RSTRING_CPTR(rval)[0];
+	    if (TYPE(rval) == T_STRING && RSTRING_LEN(rval) == 1) {
+		*(char *)ocval = RSTRING_PTR(rval)[0];
 	    }
 	    else {
 		*(char *)ocval = (char) NUM2INT(rb_Integer(rval));
@@ -846,7 +846,7 @@
     if (!ok)
     	rb_raise(rb_eArgError, "can't convert Ruby object `%s' to " \
 		 "Objective-C value of type `%s'", 
-		 RSTRING_CPTR(rb_inspect(rval)), octype);
+		 RSTRING_PTR(rb_inspect(rval)), octype);
 }
 
 VALUE
@@ -1941,7 +1941,7 @@
     }
 
     rb_bug("can't find field `%s' in recv `%s'", ivar_id_str,
-	   RSTRING_CPTR(rb_inspect(recv)));
+	   RSTRING_PTR(rb_inspect(recv)));
 
     return Qnil;
 }
@@ -1982,7 +1982,7 @@
     }
 
     rb_bug("can't find field `%s' in recv `%s'", ivar_id_str,
-	   RSTRING_CPTR(rb_inspect(recv)));
+	   RSTRING_PTR(rb_inspect(recv)));
 
     return Qnil;
 }
@@ -2027,12 +2027,12 @@
     d1 = bs_element_boxed_get_data(bs_boxed, recv, &ok);
     if (!ok)
 	rb_raise(rb_eRuntimeError, "can't retrieve data for boxed `%s'",
-		 RSTRING_CPTR(rb_inspect(recv)));
+		 RSTRING_PTR(rb_inspect(recv)));
 
     d2 = bs_element_boxed_get_data(bs_boxed, other, &ok);
     if (!ok)
 	rb_raise(rb_eRuntimeError, "can't retrieve data for boxed `%s'",
-		 RSTRING_CPTR(rb_inspect(recv)));
+		 RSTRING_PTR(rb_inspect(recv)));
 
     if (d1 == d2)
 	return Qtrue;
@@ -2052,7 +2052,7 @@
     data = bs_element_boxed_get_data(bs_boxed, recv, &ok);
     if (!ok)
 	rb_raise(rb_eRuntimeError, "can't retrieve data for boxed `%s'",
-		 RSTRING_CPTR(rb_inspect(recv)));
+		 RSTRING_PTR(rb_inspect(recv)));
 
     if (data == NULL)
 	return Qnil;
@@ -2444,7 +2444,7 @@
     rb_scan_args(argc, argv, "11", &framework, &search_network);
 
     Check_Type(framework, T_STRING);
-    cstr = RSTRING_CPTR(framework);
+    cstr = RSTRING_PTR(framework);
 
     fileManager = [NSFileManager defaultManager];
     path = [fileManager stringWithFileSystemRepresentation:cstr
@@ -2502,7 +2502,7 @@
 #undef FIND_LOAD_PATH_IN_LIBRARY
 
 	rb_raise(rb_eRuntimeError, "framework `%s' not found", 
-	    RSTRING_CPTR(framework));
+	    RSTRING_PTR(framework));
     }
 
 success:
@@ -2556,7 +2556,7 @@
     if (!ok)
 	[NSException raise:@"NSException" 
 	    format:@"can't get internal data for boxed type `%s'",
-	    RSTRING_CPTR(rb_inspect((VALUE)rcv))];
+	    RSTRING_PTR(rb_inspect((VALUE)rcv))];
     if (data == NULL) {
 	*(void **)buffer = NULL; 
     }
@@ -2984,7 +2984,7 @@
     new_fmt = NULL;
 
     rb_objc_get_types_for_format_str(types, argc, (VALUE *)argv, 
-	    RSTRING_CPTR(fmt), &new_fmt);
+	    RSTRING_PTR(fmt), &new_fmt);
     if (new_fmt != NULL) {
 	fmt = (VALUE)CFStringCreateWithCString(NULL, new_fmt, 
 		kCFStringEncodingUTF8);

Modified: MacRuby/trunk/object.c
===================================================================
--- MacRuby/trunk/object.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/object.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -340,7 +340,7 @@
     const char *ivname;
     const char *cstr;
 
-    cstr = RSTRING_CPTR(str);
+    cstr = RSTRING_PTR(str);
 
     /* need not to show internal data */
     if (CLASS_OF(value) == 0) return ST_CONTINUE;
@@ -350,7 +350,7 @@
 #if WITH_OBJC
 	rb_str_update(str, 0, 0, rb_str_new2("#"));
 #else
-	RSTRING_PTR(str)[0] = '#';
+	RSTRING_BYTEPTR(str)[0] = '#';
 #endif
 	rb_str_cat2(str, " ");
     }
@@ -380,7 +380,7 @@
 #if WITH_OBJC
     rb_str_update(str, 0, 0, rb_str_new2("#"));
 #else
-    RSTRING_PTR(str)[0] = '#';
+    RSTRING_BYTEPTR(str)[0] = '#';
 #endif
     OBJ_INFECT(str, obj);
 
@@ -2194,8 +2194,8 @@
     long len;
 
     StringValue(str);
-    s = RSTRING_CPTR(str);
-    len = RSTRING_CLEN(str);
+    s = RSTRING_PTR(str);
+    len = RSTRING_LEN(str);
     if (s) {
 	if (s[len]) {		/* no sentinel somehow */
 	    char *p = ALLOCA_N(char, len+1);
@@ -2280,11 +2280,11 @@
 rb_str2cstr(VALUE str, long *len)
 {
     StringValue(str);
-    if (len) *len = RSTRING_CLEN(str);
-    else if (RTEST(ruby_verbose) && RSTRING_CLEN(str) != strlen(RSTRING_CPTR(str))) {
+    if (len) *len = RSTRING_LEN(str);
+    else if (RTEST(ruby_verbose) && RSTRING_LEN(str) != strlen(RSTRING_PTR(str))) {
 	rb_warn("string contains \\0 character");
     }
-    return RSTRING_CPTR(str);
+    return RSTRING_PTR(str);
 }
 
 VALUE

Modified: MacRuby/trunk/pack.c
===================================================================
--- MacRuby/trunk/pack.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/pack.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -447,12 +447,12 @@
 #endif
 
     StringValue(fmt);
-    p = RSTRING_CPTR(fmt);
-    pend = p + RSTRING_CLEN(fmt);
+    p = RSTRING_PTR(fmt);
+    pend = p + RSTRING_LEN(fmt);
     res = rb_str_buf_new(0);
 
 #if WITH_OBJC
-    RSTRING_PTR(res); /* create bytestring */
+    RSTRING_BYTEPTR(res); /* create bytestring */
 #endif
 
     items = RARRAY_LEN(ary);
@@ -463,7 +463,7 @@
 #define NEXTFROM (items-- > 0 ? RARRAY_AT(ary, idx++) : TOO_FEW)
 
     while (p < pend) {
-	if (RSTRING_CPTR(fmt) + RSTRING_CLEN(fmt) != pend) {
+	if (RSTRING_PTR(fmt) + RSTRING_LEN(fmt) != pend) {
 	    rb_raise(rb_eRuntimeError, "format string modified");
 	}
 	type = *p++;		/* get data type */
@@ -517,8 +517,8 @@
 	    }
 	    else {
 		StringValue(from);
-		ptr = RSTRING_CPTR(from);
-		plen = RSTRING_CLEN(from);
+		ptr = RSTRING_PTR(from);
+		plen = RSTRING_LEN(from);
 #if !WITH_OBJC
 		OBJ_INFECT(res, from);
 #endif
@@ -852,14 +852,14 @@
 
 	  case 'X':		/* back up byte */
 	  shrink:
-	    plen = RSTRING_CLEN(res);
+	    plen = RSTRING_LEN(res);
 	    if (plen < len)
 		rb_raise(rb_eArgError, "X outside of string");
 	    rb_str_set_len(res, plen - len);
 	    break;
 
 	  case '@':		/* null fill to absolute position */
-	    len -= RSTRING_CLEN(res);
+	    len -= RSTRING_LEN(res);
 	    if (len > 0) goto grow;
 	    len = -len;
 	    if (len > 0) goto shrink;
@@ -890,8 +890,8 @@
 	  case 'm':		/* base64 encoded string */
 	    from = NEXTFROM;
 	    StringValue(from);
-	    ptr = RSTRING_CPTR(from);
-	    plen = RSTRING_CLEN(from);
+	    ptr = RSTRING_PTR(from);
+	    plen = RSTRING_LEN(from);
 
 	    if (len <= 2)
 		len = 45;
@@ -921,9 +921,9 @@
 	    from = THISFROM;
 	    if (!NIL_P(from)) {
 		StringValue(from);
-		if (RSTRING_CLEN(from) < len) {
+		if (RSTRING_LEN(from) < len) {
 		    rb_raise(rb_eArgError, "too short buffer for P(%ld for %ld)",
-			     RSTRING_CLEN(from), len);
+			     RSTRING_LEN(from), len);
 		}
 	    }
 	    len = 1;
@@ -978,16 +978,16 @@
 		    ul >>=  7;
 		}
 
-		if (RSTRING_LEN(buf)) {
-		    bufs = RSTRING_PTR(buf);
-		    bufe = bufs + RSTRING_LEN(buf) - 1;
+		if (RSTRING_BYTELEN(buf)) {
+		    bufs = RSTRING_BYTEPTR(buf);
+		    bufe = bufs + RSTRING_BYTELEN(buf) - 1;
 		    *bufs &= 0x7f; /* clear continue bit */
 		    while (bufs < bufe) { /* reverse */
 			c = *bufs;
 			*bufs++ = *bufe;
 			*bufe-- = c;
 		    }
-		    rb_str_buf_cat(res, RSTRING_PTR(buf), RSTRING_LEN(buf));
+		    rb_str_buf_cat(res, RSTRING_BYTEPTR(buf), RSTRING_BYTELEN(buf));
 		}
 		else {
 		    c = 0;
@@ -1058,8 +1058,8 @@
 {
     char buff[1024];
     long i = 0, n = 0, prev = EOF;
-    const unsigned char *s = (unsigned char*)RSTRING_CPTR(from);
-    const unsigned char *send = s + RSTRING_CLEN(from);
+    const unsigned char *s = (unsigned char*)RSTRING_PTR(from);
+    const unsigned char *send = s + RSTRING_LEN(from);
 
     while (s < send) {
         if ((*s > 126) ||
@@ -1322,10 +1322,10 @@
 
     StringValue(str);
     StringValue(fmt);
-    s = RSTRING_CPTR(str);
-    send = s + RSTRING_CLEN(str);
-    p = RSTRING_CPTR(fmt);
-    pend = p + RSTRING_CLEN(fmt);
+    s = RSTRING_PTR(str);
+    send = s + RSTRING_LEN(str);
+    p = RSTRING_PTR(fmt);
+    pend = p + RSTRING_LEN(fmt);
 
     ary = block_p ? Qnil : rb_ary_new();
     while (p < pend) {
@@ -1422,7 +1422,7 @@
 		    len = (send - s) * 8;
 		bits = 0;
 		UNPACK_PUSH(bitstr = rb_str_new(0, len));
-		t = RSTRING_PTR(bitstr);
+		t = RSTRING_BYTEPTR(bitstr);
 		for (i=0; i<len; i++) {
 		    if (i & 7) bits >>= 1;
 		    else bits = *s++;
@@ -1443,7 +1443,7 @@
 		    len = (send - s) * 8;
 		bits = 0;
 		UNPACK_PUSH(bitstr = rb_str_new(0, len));
-		t = RSTRING_PTR(bitstr);
+		t = RSTRING_BYTEPTR(bitstr);
 		for (i=0; i<len; i++) {
 		    if (i & 7) bits <<= 1;
 		    else bits = *s++;
@@ -1464,7 +1464,7 @@
 		    len = (send - s) * 2;
 		bits = 0;
 		UNPACK_PUSH(bitstr = rb_str_new(0, len));
-		t = RSTRING_PTR(bitstr);
+		t = RSTRING_BYTEPTR(bitstr);
 		for (i=0; i<len; i++) {
 		    if (i & 1)
 			bits >>= 4;
@@ -1487,7 +1487,7 @@
 		    len = (send - s) * 2;
 		bits = 0;
 		UNPACK_PUSH(bitstr = rb_str_new(0, len));
-		t = RSTRING_PTR(bitstr);
+		t = RSTRING_BYTEPTR(bitstr);
 		for (i=0; i<len; i++) {
 		    if (i & 1)
 			bits <<= 4;
@@ -1742,7 +1742,7 @@
 	  case 'u':
 	    {
 		VALUE buf = infected_str_new(0, (send - s)*3/4, str);
-		char *ptr = RSTRING_PTR(buf);
+		char *ptr = RSTRING_BYTEPTR(buf);
 		long total = 0;
 
 		while (s < send && *s > ' ' && *s < 'a') {
@@ -1752,9 +1752,9 @@
 		    hunk[3] = '\0';
 		    len = (*s++ - ' ') & 077;
 		    total += len;
-		    if (total > RSTRING_LEN(buf)) {
-			len -= total - RSTRING_LEN(buf);
-			total = RSTRING_LEN(buf);
+		    if (total > RSTRING_BYTELEN(buf)) {
+			len -= total - RSTRING_BYTELEN(buf);
+			total = RSTRING_BYTELEN(buf);
 		    }
 
 		    while (len > 0) {
@@ -1798,7 +1798,7 @@
 	  case 'm':
 	    {
 		VALUE buf = infected_str_new(0, (send - s)*3/4, str);
-		char *ptr = RSTRING_PTR(buf);
+		char *ptr = RSTRING_BYTEPTR(buf);
 		int a = -1,b = -1,c = 0,d;
 		static int first = 1;
 		static int b64_xtable[256];
@@ -1840,7 +1840,7 @@
 			*ptr++ = b << 4 | c >> 2;
 		    }
 		}
-		rb_str_set_len(buf, ptr - RSTRING_PTR(buf));
+		rb_str_set_len(buf, ptr - RSTRING_BYTEPTR(buf));
 		RSTRING_SYNC(buf);
 		UNPACK_PUSH(buf);
 	    }
@@ -1849,7 +1849,7 @@
 	  case 'M':
 	    {
 		VALUE buf = infected_str_new(0, send - s, str);
-		char *ptr = RSTRING_PTR(buf);
+		char *ptr = RSTRING_BYTEPTR(buf);
 		int c1, c2;
 
 		while (s < send) {
@@ -1869,20 +1869,20 @@
 		    }
 		    s++;
 		}
-		rb_str_set_len(buf, ptr - RSTRING_PTR(buf));
+		rb_str_set_len(buf, ptr - RSTRING_BYTEPTR(buf));
 		RSTRING_SYNC(buf);
 		UNPACK_PUSH(buf);
 	    }
 	    break;
 
 	  case '@':
-	    if (len > RSTRING_CLEN(str))
+	    if (len > RSTRING_LEN(str))
 		rb_raise(rb_eArgError, "@ outside of string");
-	    s = RSTRING_CPTR(str) + len;
+	    s = RSTRING_PTR(str) + len;
 	    break;
 
 	  case 'X':
-	    if (len > s - RSTRING_CPTR(str))
+	    if (len > s - RSTRING_PTR(str))
 		rb_raise(rb_eArgError, "X outside of string");
 	    s -= len;
 	    break;
@@ -1911,8 +1911,8 @@
 		    count = RARRAY_LEN(a);
 		    for (i = 0; i < count; i++) {
 			VALUE p = RARRAY_AT(a, i);
-			if (TYPE(p) == T_STRING && RSTRING_CPTR(p) == t) {
-			    if (len < RSTRING_CLEN(p)) {
+			if (TYPE(p) == T_STRING && RSTRING_PTR(p) == t) {
+			    if (len < RSTRING_LEN(p)) {
 				tmp = rb_tainted_str_new(t, len);
 				rb_str_associate(tmp, a);
 			    }
@@ -1934,8 +1934,8 @@
 		    p = RARRAY_PTR(a);
 		    pend = p + RARRAY_LEN(a);
 		    while (p < pend) {
-			if (TYPE(*p) == T_STRING && RSTRING_PTR(*p) == t) {
-			    if (len < RSTRING_LEN(*p)) {
+			if (TYPE(*p) == T_STRING && RSTRING_BYTEPTR(*p) == t) {
+			    if (len < RSTRING_BYTELEN(*p)) {
 				tmp = rb_tainted_str_new(t, len);
 				rb_str_associate(tmp, a);
 			    }
@@ -1982,7 +1982,7 @@
 			count = RARRAY_LEN(a);
 			for (i = 0; i < count; i++) {
 			    VALUE p = RARRAY_AT(a, i);
-			    if (TYPE(p) == T_STRING && RSTRING_CPTR(p) == t) {
+			    if (TYPE(p) == T_STRING && RSTRING_PTR(p) == t) {
 				tmp = p;
 				break;
 			    }
@@ -1999,7 +1999,7 @@
 			p = RARRAY_PTR(a);
 			pend = p + RARRAY_LEN(a);
 			while (p < pend) {
-			    if (TYPE(*p) == T_STRING && RSTRING_CPTR(*p) == t) {
+			    if (TYPE(*p) == T_STRING && RSTRING_PTR(*p) == t) {
 				tmp = *p;
 				break;
 			    }

Modified: MacRuby/trunk/parse.y
===================================================================
--- MacRuby/trunk/parse.y	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/parse.y	2008-07-09 23:03:30 UTC (rev 348)
@@ -4918,8 +4918,8 @@
     const char *cptr, *beg, *end, *pend;
     long clen;
 
-    cptr = beg = RSTRING_PTR(s);
-    clen = RSTRING_LEN(s);
+    cptr = beg = RSTRING_BYTEPTR(s);
+    clen = RSTRING_BYTELEN(s);
     if (lex_gets_ptr) {
 	if (clen == lex_gets_ptr) return Qnil;
 	beg += lex_gets_ptr;
@@ -5109,8 +5109,8 @@
 	    }
 	    ruby_sourceline++;
 	    parser->line_count++;
-	    lex_pbeg = lex_p = RSTRING_PTR(v);
-	    lex_pend = lex_p + RSTRING_LEN(v);
+	    lex_pbeg = lex_p = RSTRING_BYTEPTR(v);
+	    lex_pend = lex_p + RSTRING_BYTELEN(v);
 #ifdef RIPPER
 	    ripper_flush(parser);
 #endif
@@ -5507,7 +5507,7 @@
     /* TODO: should use another API? */
 #if !WITH_OBJC
     if (RBASIC(str)->flags & RSTRING_NOEMBED)
-	xfree(RSTRING_PTR(str));
+	xfree(RSTRING_BYTEPTR(str));
 #endif
     rb_gc_force_recycle(str);
 }
@@ -5800,8 +5800,8 @@
 #endif
     line = here->nd_orig;
     lex_lastline = line;
-    lex_pbeg = RSTRING_PTR(line);
-    lex_pend = lex_pbeg + RSTRING_LEN(line);
+    lex_pbeg = RSTRING_BYTEPTR(line);
+    lex_pend = lex_pbeg + RSTRING_BYTELEN(line);
     lex_p = lex_pbeg + here->nd_nth;
     heredoc_end = ruby_sourceline;
     ruby_sourceline = nd_line(here);
@@ -5836,8 +5836,8 @@
     long len;
     VALUE str = 0;
 
-    eos = RSTRING_CPTR(here->nd_lit);
-    len = RSTRING_CLEN(here->nd_lit) - 1;
+    eos = RSTRING_PTR(here->nd_lit);
+    len = RSTRING_LEN(here->nd_lit) - 1;
     indent = (func = *eos++) & STR_FUNC_INDENT;
 
     if ((c = nextc()) == -1) {
@@ -5855,7 +5855,7 @@
 
     if (!(func & STR_FUNC_EXPAND)) {
 	do {
-	    p = RSTRING_CPTR(lex_lastline);
+	    p = RSTRING_PTR(lex_lastline);
 	    pend = lex_pend;
 	    if (pend > p) {
 		switch (pend[-1]) {
@@ -6056,7 +6056,7 @@
 #else
 # define str_copy(_s, _p, _n) ((_s) \
 	? (rb_str_resize((_s), (_n)), \
-	   MEMCPY(RSTRING_PTR(_s), (_p), char, (_n)), (_s)) \
+	   MEMCPY(RSTRING_BYTEPTR(_s), (_p), char, (_n)), (_s)) \
 	: ((_s) = STR_NEW((_p), (_n))))
 #endif
 
@@ -6119,13 +6119,13 @@
 	str_copy(name, beg, n);
 #ifndef RIPPER
 	do {
-	    if (STRNCASECMP(p->name, RSTRING_CPTR(name), n) == 0) {
+	    if (STRNCASECMP(p->name, RSTRING_PTR(name), n) == 0) {
 		n = vend - vbeg;
 		if (p->length) {
 		    n = (*p->length)(parser, vbeg, n);
 		}
 		str_copy(val, vbeg, n);
-		(*p->func)(parser, RSTRING_CPTR(name), RSTRING_CPTR(val));
+		(*p->func)(parser, RSTRING_PTR(name), RSTRING_PTR(val));
 		break;
 	    }
 	} while (++p < magic_comments + sizeof(magic_comments) / sizeof(*p));
@@ -6176,7 +6176,7 @@
     beg = str;
     while ((*str == '-' || *str == '_' || ISALNUM(*str)) && ++str < send);
     s = rb_str_new(beg, parser_encode_length(parser, beg, str - beg));
-    parser_set_encode(parser, RSTRING_CPTR(s));
+    parser_set_encode(parser, RSTRING_PTR(s));
     rb_str_resize(s, 0);
 }
 
@@ -8886,7 +8886,7 @@
     err = rb_reg_check_preprocess(str);
     if (err != Qnil) {
         err = rb_obj_as_string(err);
-        compile_error(PARSER_ARG "%s", RSTRING_CPTR(err));
+        compile_error(PARSER_ARG "%s", RSTRING_PTR(err));
 	RB_GC_GUARD(err);
     }
 }
@@ -8987,7 +8987,7 @@
 	    rb_str_append(rb_str_cat(rb_attr_get(err, mesg), "\n", 1), m);
 	}
 	else {
-	    compile_error(PARSER_ARG "%s", RSTRING_CPTR(m));
+	    compile_error(PARSER_ARG "%s", RSTRING_PTR(m));
 	}
 	return Qnil;
     }
@@ -9511,7 +9511,7 @@
 	enc = rb_enc_get(str);
     }
 #endif
-    id = rb_intern3(RSTRING_CPTR(str), RSTRING_CLEN(str), enc);
+    id = rb_intern3(RSTRING_PTR(str), RSTRING_LEN(str), enc);
     RB_GC_GUARD(str);
     return id;
 }
@@ -9587,7 +9587,7 @@
     VALUE str = rb_id2str(id);
 
     if (!str) return 0;
-    return RSTRING_CPTR(str);
+    return RSTRING_PTR(str);
 }
 
 static int
@@ -10210,7 +10210,7 @@
     parser_initialize(parser);
 
     parser->parser_ruby_sourcefile_string = fname;
-    parser->parser_ruby_sourcefile = RSTRING_PTR(fname);
+    parser->parser_ruby_sourcefile = RSTRING_BYTEPTR(fname);
     parser->parser_ruby_sourceline = NIL_P(lineno) ? 0 : NUM2INT(lineno) - 1;
 
     return Qnil;
@@ -10321,7 +10321,7 @@
 {
     StringValue(msg);
     if (obj == Qundef) {
-        rb_raise(rb_eArgError, "%s", RSTRING_CPTR(msg));
+        rb_raise(rb_eArgError, "%s", RSTRING_PTR(msg));
     }
     return Qnil;
 }

Modified: MacRuby/trunk/proc.c
===================================================================
--- MacRuby/trunk/proc.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/proc.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -676,7 +676,7 @@
 	    line_no = iseq->insn_info_table[0].line_no;
 	}
 	str = rb_sprintf("#<%s:%p@%s:%d%s>", cname, (void *)self,
-			 RSTRING_CPTR(iseq->filename),
+			 RSTRING_PTR(iseq->filename),
 			 line_no, is_lambda);
     }
     else {

Modified: MacRuby/trunk/process.c
===================================================================
--- MacRuby/trunk/process.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/process.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -1045,7 +1045,7 @@
 
     args = ALLOCA_N(char*, argc+1);
     for (i=0; i<argc; i++) {
-	args[i] = (char *)RSTRING_CPTR(argv[i]);
+	args[i] = (char *)RSTRING_PTR(argv[i]);
     }
     args[i] = 0;
     if (args[0]) {
@@ -1188,11 +1188,11 @@
 
     args = ALLOCA_N(char*, argc + 1);
     for (i = 0; i < argc; i++) {
-	args[i] = RSTRING_CPTR(argv[i]);
+	args[i] = RSTRING_PTR(argv[i]);
     }
     args[i] = (char*) 0;
     if (args[0])
-	return proc_spawn_v(args, prog ? RSTRING_CPTR(prog) : 0);
+	return proc_spawn_v(args, prog ? RSTRING_PTR(prog) : 0);
     return -1;
 }
 
@@ -1592,14 +1592,14 @@
 	SafeStringValue(prog);
 	StringValueCStr(prog);
 	prog = rb_str_new4(prog);
-	name = RSTRING_CPTR(prog);
+	name = RSTRING_PTR(prog);
     }
     for (i = 0; i < argc; i++) {
 	SafeStringValue(argv[i]);
 	argv[i] = rb_str_new4(argv[i]);
 	StringValueCStr(argv[i]);
     }
-    security(name ? name : RSTRING_CPTR(argv[0]));
+    security(name ? name : RSTRING_PTR(argv[0]));
     return prog;
 }
 
@@ -1653,7 +1653,7 @@
 
     e->argc = argc;
     e->argv = argv;
-    e->prog = prog ? RSTRING_CPTR(prog) : 0;
+    e->prog = prog ? RSTRING_PTR(prog) : 0;
 }
 
 VALUE
@@ -1979,7 +1979,7 @@
         VALUE elt = RARRAY_AT(ary, i);;
         int fd = FIX2INT(RARRAY_AT(elt, 0));
         VALUE param = RARRAY_AT(elt, 1);
-        const char *path = RSTRING_CPTR(RARRAY_AT(param, 0));
+        const char *path = RSTRING_PTR(RARRAY_AT(param, 0));
         int flags = NUM2INT(RARRAY_AT(param, 1));
         int perm = NUM2INT(RARRAY_AT(param, 2));
         int need_close = 1;
@@ -2122,7 +2122,7 @@
             rb_ary_store(soptions, EXEC_OPTION_CHDIR,
                          hide_obj(rb_str_new2(cwd)));
         }
-        if (chdir(RSTRING_CPTR(obj)) == -1)
+        if (chdir(RSTRING_PTR(obj)) == -1)
             return -1;
     }
 
@@ -2671,7 +2671,7 @@
     if (prog && argc) argv[0] = prog;
 # if defined HAVE_SPAWNV
     if (!argc) {
-	status = proc_spawn(RSTRING_CPTR(prog));
+	status = proc_spawn(RSTRING_PTR(prog));
     }
     else {
 	status = proc_spawn_n(argc, argv, prog);
@@ -2902,7 +2902,7 @@
     rb_pid_t pid;
 
     pid = rb_spawn(argc, argv);
-    if (pid == -1) rb_sys_fail(RSTRING_CPTR(argv[0]));
+    if (pid == -1) rb_sys_fail(RSTRING_PTR(argv[0]));
 #if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
     return PIDT2NUM(pid);
 #else
@@ -4118,10 +4118,10 @@
 		groups[i] = NUM2GIDT(g);
 	    }
 	    else {
-		gr = getgrnam(RSTRING_CPTR(tmp));
+		gr = getgrnam(RSTRING_PTR(tmp));
 		if (gr == NULL)
 		    rb_raise(rb_eArgError,
-			     "can't find group for %s", RSTRING_CPTR(tmp));
+			     "can't find group for %s", RSTRING_PTR(tmp));
 		groups[i] = gr->gr_gid;
 	    }
 	}

Modified: MacRuby/trunk/range.c
===================================================================
--- MacRuby/trunk/range.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/range.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -750,15 +750,15 @@
 	return Qfalse;
     }
     else if (TYPE(beg) == T_STRING && TYPE(end) == T_STRING &&
-	     RSTRING_CLEN(beg) == 1 && RSTRING_CLEN(end) == 1) {
+	     RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1) {
 	if (NIL_P(val)) return Qfalse;
 	if (TYPE(val) == T_STRING) {
-	    if (RSTRING_CLEN(val) == 0 || RSTRING_CLEN(val) > 1)
+	    if (RSTRING_LEN(val) == 0 || RSTRING_LEN(val) > 1)
 		return Qfalse;
 	    else {
-		char b = RSTRING_CPTR(beg)[0];
-		char e = RSTRING_CPTR(end)[0];
-		char v = RSTRING_CPTR(val)[0];
+		char b = RSTRING_PTR(beg)[0];
+		char e = RSTRING_PTR(end)[0];
+		char v = RSTRING_PTR(val)[0];
 
 		if (ISASCII(b) && ISASCII(e) && ISASCII(v)) {
 		    if (b <= v && v < e) return Qtrue;

Modified: MacRuby/trunk/rational.c
===================================================================
--- MacRuby/trunk/rational.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/rational.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -1333,7 +1333,7 @@
 
     s = f_strip(self);
 
-    if (RSTRING_CLEN(s) == 0)
+    if (RSTRING_LEN(s) == 0)
 	return rb_assoc_new(Qnil, self);
 
     m = f_match(rat_pat, s);
@@ -1397,7 +1397,7 @@
 string_to_r_strict(VALUE self)
 {
     VALUE a = string_to_r_internal(self);
-    if (NIL_P(RARRAY_AT(a, 0)) || RSTRING_CLEN(RARRAY_AT(a, 1)) > 0) {
+    if (NIL_P(RARRAY_AT(a, 0)) || RSTRING_LEN(RARRAY_AT(a, 1)) > 0) {
 	VALUE s = f_inspect(self);
 	rb_raise(rb_eArgError, "invalid value for Rational: %s",
 		 StringValuePtr(s));

Modified: MacRuby/trunk/re.c
===================================================================
--- MacRuby/trunk/re.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/re.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -602,7 +602,7 @@
 {
     VALUE desc = rb_reg_desc(s, len, re);
 
-    rb_raise(rb_eRegexpError, "%s: %s", err, RSTRING_CPTR(desc));
+    rb_raise(rb_eRegexpError, "%s: %s", err, RSTRING_PTR(desc));
 }
 
 static VALUE
@@ -631,7 +631,7 @@
 static VALUE
 rb_reg_error_desc(VALUE str, int options, const char *err)
 {
-    return rb_enc_reg_error_desc(RSTRING_CPTR(str), RSTRING_CLEN(str),
+    return rb_enc_reg_error_desc(RSTRING_PTR(str), RSTRING_LEN(str),
 				 rb_enc_get(str), options, err);
 }
 
@@ -892,8 +892,8 @@
     }
     qsort(pairs, num_pos, sizeof(pair_t), pair_byte_cmp);
 
-    s = p = RSTRING_CPTR(RMATCH(match)->str);
-    e = s + RSTRING_CLEN(RMATCH(match)->str);
+    s = p = RSTRING_PTR(RMATCH(match)->str);
+    e = s + RSTRING_LEN(RMATCH(match)->str);
     c = 0;
     for (i = 0; i < num_pos; i++) {
         q = s + pairs[i].byte_pos;
@@ -1299,8 +1299,8 @@
     enc = (rb_encoding *)ONIG_ENCODING_ASCII;
 #endif
 
-    r = onig_new(&reg, (UChar* )RSTRING_PTR(unescaped),
-		 (UChar* )(RSTRING_PTR(unescaped) + RSTRING_LEN(unescaped)),
+    r = onig_new(&reg, (UChar* )RSTRING_BYTEPTR(unescaped),
+		 (UChar* )(RSTRING_BYTEPTR(unescaped) + RSTRING_BYTELEN(unescaped)),
 		 reg->options, (OnigEncoding)enc,
 		 OnigDefaultSyntax, &einfo);
     if (r) {
@@ -1327,12 +1327,12 @@
 	range = -pos;
     }
     else {
-	range = RSTRING_CLEN(str) - pos;
+	range = RSTRING_LEN(str) - pos;
     }
 
 #if !WITH_OBJC
-    if (pos > 0 && ONIGENC_MBC_MAXLEN(enc) != 1 && pos < RSTRING_CLEN(str)) {
-	 string = (UChar*)RSTRING_CPTR(str);
+    if (pos > 0 && ONIGENC_MBC_MAXLEN(enc) != 1 && pos < RSTRING_LEN(str)) {
+	 string = (UChar*)RSTRING_PTR(str);
 
 	 if (range > 0) {
 	      p = onigenc_get_right_adjust_char_head(enc, string, string + pos);
@@ -1358,8 +1358,8 @@
     regex_t *reg0 = RREGEXP(re)->ptr, *reg;
     int busy = FL_TEST(re, REG_BUSY);
 
-    cstr = range = RSTRING_CPTR(str);
-    clen = RSTRING_CLEN(str);
+    cstr = range = RSTRING_PTR(str);
+    clen = RSTRING_LEN(str);
 #if WITH_OBJC
     static struct re_registers *regs = NULL;
     if (regs == NULL) {
@@ -1381,7 +1381,7 @@
 
     FL_SET(re, REG_BUSY);
     if (!reverse) {
-	range += RSTRING_CLEN(str);
+	range += RSTRING_LEN(str);
     }
     MEMZERO(&regs, struct re_registers, 1);
     result = onig_search(RREGEXP(re)->ptr,
@@ -1544,7 +1544,7 @@
     if (BEG(0) == -1) return Qnil;
     str = RMATCH(match)->str;
     pos = END(0);
-    str = rb_str_subseq(str, pos, RSTRING_CLEN(str) - pos);
+    str = rb_str_subseq(str, pos, RSTRING_LEN(str) - pos);
     if (OBJ_TAINTED(match)) OBJ_TAINT(str);
     return str;
 }
@@ -2317,8 +2317,8 @@
     rb_encoding *enc;
 
     StringValue(str);
-    p = RSTRING_CPTR(str);
-    end = p + RSTRING_CLEN(str);
+    p = RSTRING_PTR(str);
+    end = p + RSTRING_LEN(str);
     enc = rb_enc_get(str);
 
     buf = rb_reg_preprocess(p, end, enc, &fixed_enc, err);
@@ -2358,8 +2358,8 @@
         rb_encoding *src_enc;
 
         StringValue(str);
-        p = RSTRING_CPTR(str);
-        end = p + RSTRING_CLEN(str);
+        p = RSTRING_PTR(str);
+        end = p + RSTRING_LEN(str);
         src_enc = rb_enc_get(str);
 
         buf = rb_reg_preprocess(p, end, src_enc, &fixed_enc, err);
@@ -2443,8 +2443,8 @@
         re->basic.flags |= REG_ENCODING_NONE;
     }
     
-    GC_WB(&re->ptr, make_regexp(RSTRING_CPTR(unescaped), 
-				RSTRING_CLEN(unescaped), enc,
+    GC_WB(&re->ptr, make_regexp(RSTRING_PTR(unescaped), 
+				RSTRING_LEN(unescaped), enc,
                                 options & ARG_REG_OPTION_MASK, err));
     if (!re->ptr) return -1;
     GC_WB(&re->str, ALLOC_N(char, len+1));
@@ -2473,7 +2473,7 @@
         }
 #endif
     }
-    ret = rb_reg_initialize(obj, RSTRING_CPTR(str), RSTRING_CLEN(str), enc,
+    ret = rb_reg_initialize(obj, RSTRING_PTR(str), RSTRING_LEN(str), enc,
 			    options, err);
     RB_GC_GUARD(str);
     return ret;
@@ -2555,13 +2555,13 @@
 rb_reg_regcomp(VALUE str)
 {
     volatile VALUE save_str = str;
-    if (reg_cache && RREGEXP(reg_cache)->len == RSTRING_CLEN(str)
+    if (reg_cache && RREGEXP(reg_cache)->len == RSTRING_LEN(str)
 #if WITH_OBJC
 	&& rb_enc_get(reg_cache) == rb_enc_get(str)
 #else
 	&& ENCODING_GET(reg_cache) == ENCODING_GET(str)
 #endif
-        && memcmp(RREGEXP(reg_cache)->str, RSTRING_CPTR(str), RSTRING_CLEN(str)) == 0)
+        && memcmp(RREGEXP(reg_cache)->str, RSTRING_PTR(str), RSTRING_LEN(str)) == 0)
 	return reg_cache;
 
     return reg_cache = rb_reg_new_str(save_str, 0);
@@ -2917,7 +2917,7 @@
 	str = argv[0];
 	ptr = StringValuePtr(str);
 	if (enc
-	    ? rb_reg_initialize(self, ptr, RSTRING_CLEN(str), enc, flags, err)
+	    ? rb_reg_initialize(self, ptr, RSTRING_LEN(str), enc, flags, err)
 	    : rb_reg_initialize_str(self, str, flags, err)) {
 	    rb_reg_raise_str(str, flags, err);
 	}
@@ -2941,10 +2941,10 @@
     int ascii_only = rb_enc_str_asciionly_p(str);
 #endif
 
-    s = RSTRING_CPTR(str);
+    s = RSTRING_PTR(str);
     if (s == NULL)
 	return str;
-    send = s + RSTRING_CLEN(str);
+    send = s + RSTRING_LEN(str);
     while (s < send) {
 #if WITH_OBJC
 	c = *s;
@@ -2976,7 +2976,7 @@
     return str;
 
   meta_found:
-    tmp = rb_str_new(0, RSTRING_CLEN(str)*2);
+    tmp = rb_str_new(0, RSTRING_LEN(str)*2);
 #if !WITH_OBJC
     if (ascii_only) {
         rb_enc_associate(tmp, rb_usascii_encoding());
@@ -2985,10 +2985,10 @@
         rb_enc_copy(tmp, str);
     }
 #endif
-    t = RSTRING_PTR(tmp);
+    t = RSTRING_BYTEPTR(tmp);
     /* copy upto metacharacter */
-    memcpy(t, RSTRING_CPTR(str), s - RSTRING_CPTR(str));
-    t += s - RSTRING_CPTR(str);
+    memcpy(t, RSTRING_PTR(str), s - RSTRING_PTR(str));
+    t += s - RSTRING_PTR(str);
 
     while (s < send) {
 #if WITH_OBJC
@@ -3040,7 +3040,7 @@
 	}
 	*t++ = c;
     }
-    rb_str_resize(tmp, t - RSTRING_PTR(tmp));
+    rb_str_resize(tmp, t - RSTRING_BYTEPTR(tmp));
     RSTRING_SYNC(tmp);
 #if !WITH_OBJC
     OBJ_INFECT(tmp, str);
@@ -3295,8 +3295,8 @@
 #if !WITH_OBJC
     rb_enc_check(str, src);
 #endif
-    p = s = RSTRING_CPTR(str);
-    e = s + RSTRING_CLEN(str);
+    p = s = RSTRING_PTR(str);
+    e = s + RSTRING_LEN(str);
 
     while (s < e) {
 	const char *ss;
@@ -3387,11 +3387,11 @@
 	    break;
 
 	  case '`':
-	    rb_enc_str_buf_cat(val, RSTRING_CPTR(src), BEG(0), src_enc);
+	    rb_enc_str_buf_cat(val, RSTRING_PTR(src), BEG(0), src_enc);
 	    continue;
 
 	  case '\'':
-	    rb_enc_str_buf_cat(val, RSTRING_CPTR(src)+END(0), RSTRING_CLEN(src)-END(0), src_enc);
+	    rb_enc_str_buf_cat(val, RSTRING_PTR(src)+END(0), RSTRING_LEN(src)-END(0), src_enc);
 	    continue;
 
 	  case '+':
@@ -3412,7 +3412,7 @@
 	if (no >= 0) {
 	    if (no >= regs->num_regs) continue;
 	    if (BEG(no) == -1) continue;
-	    rb_enc_str_buf_cat(val, RSTRING_CPTR(src)+BEG(no), END(no)-BEG(no), src_enc);
+	    rb_enc_str_buf_cat(val, RSTRING_PTR(src)+BEG(no), END(no)-BEG(no), src_enc);
 	}
     }
 

Modified: MacRuby/trunk/ruby.c
===================================================================
--- MacRuby/trunk/ruby.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/ruby.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -212,7 +212,7 @@
 	return rb_str_new(s, l);
     }
     ret = rb_str_new(0, l + newl - oldl);
-    ptr = RSTRING_PTR(ret); /* ok */
+    ptr = RSTRING_BYTEPTR(ret); /* ok */
     memcpy(ptr, newp, newl);
     memcpy(ptr + newl, s + oldl, l - oldl);
     ptr[l + newl - oldl] = 0;
@@ -267,11 +267,11 @@
 	if (*s) {
 	    if (!buf) {
 		buf = rb_str_new(p, len);
-		p = RSTRING_CPTR(buf);
+		p = RSTRING_PTR(buf);
 	    }
 	    else {
 		rb_str_resize(buf, len);
-		p = strncpy(RSTRING_PTR(buf), p, len); /* ok */
+		p = strncpy(RSTRING_BYTEPTR(buf), p, len); /* ok */
 		RSTRING_SYNC(buf);
 	    }
 	}
@@ -309,7 +309,7 @@
 static VALUE
 expand_include_path(VALUE path)
 {
-    const char *p = RSTRING_CPTR(path);
+    const char *p = RSTRING_PTR(path);
     if (!p)
 	return path;
     if (*p == '.' && p[1] == '/')
@@ -951,14 +951,14 @@
     rb_encoding *enc = rb_enc_find2(enc_name);
     if (enc == NULL)
 	rb_raise(rb_eRuntimeError, "unknown encoding name - %s", 
-	    RSTRING_CPTR(enc_name));
+	    RSTRING_PTR(enc_name));
     return enc;
 }
 #else
 static int
 opt_enc_index(VALUE enc_name)
 {
-    const char *s = RSTRING_CPTR(enc_name);
+    const char *s = RSTRING_PTR(enc_name);
     int i = rb_enc_find_index(s);
 
     if (i < 0) {
@@ -1088,10 +1088,10 @@
 
     ruby_script(opt->script);
 #if defined DOSISH || defined __CYGWIN__
-    translate_char(RSTRING_CPTR(rb_progname), '\\', '/');
+    translate_char(RSTRING_PTR(rb_progname), '\\', '/');
 #endif
     opt->script_name = rb_str_new4(rb_progname);
-    opt->script = RSTRING_PTR(opt->script_name);
+    opt->script = RSTRING_BYTEPTR(opt->script_name);
     ruby_set_argv(argc, argv);
     process_sflag(opt);
 
@@ -1246,8 +1246,8 @@
 	    opt->xflag = Qfalse;
 	    while (!NIL_P(line = rb_io_gets(f))) {
 		line_start++;
-		const char *lineptr = RSTRING_CPTR(line);
-		if (RSTRING_CLEN(line) > 2
+		const char *lineptr = RSTRING_PTR(line);
+		if (RSTRING_LEN(line) > 2
 		    && lineptr[0] == '#'
 		    && lineptr[1] == '!') {
 		    if ((p = strstr(lineptr, "ruby")) != 0) {
@@ -1266,13 +1266,13 @@
 		if (NIL_P(line))
 		    return 0;
 
-		if ((p = strstr(RSTRING_CPTR(line), "ruby")) == 0) {
+		if ((p = strstr(RSTRING_PTR(line), "ruby")) == 0) {
 		    /* not ruby script, kick the program */
 		    char **argv;
 		    char *path;
-		    char *pend = RSTRING_PTR(line) + RSTRING_LEN(line);
+		    char *pend = RSTRING_BYTEPTR(line) + RSTRING_BYTELEN(line);
 
-		    p = RSTRING_PTR(line);	/* skip `#!' */
+		    p = RSTRING_BYTEPTR(line);	/* skip `#!' */
 		    if (pend[-1] == '\n')
 			pend--;	/* chomp line */
 		    if (pend[-1] == '\r')
@@ -1300,9 +1300,9 @@
 
 	      start_read:
 		p += 4;
-		RSTRING_PTR(line)[RSTRING_LEN(line) - 1] = '\0';
-		if (RSTRING_PTR(line)[RSTRING_LEN(line) - 2] == '\r')
-		    RSTRING_PTR(line)[RSTRING_LEN(line) - 2] = '\0';
+		RSTRING_BYTEPTR(line)[RSTRING_BYTELEN(line) - 1] = '\0';
+		if (RSTRING_BYTEPTR(line)[RSTRING_BYTELEN(line) - 2] == '\r')
+		    RSTRING_BYTEPTR(line)[RSTRING_BYTELEN(line) - 2] = '\0';
 		if ((p = strstr(p, " -")) != 0) {
 		    p++;	/* skip space before `-' */
 		    while (*p == '-') {
@@ -1435,8 +1435,8 @@
     if (origarg.argv == 0)
 	rb_raise(rb_eRuntimeError, "$0 not initialized");
     StringValue(val);
-    s = RSTRING_CPTR(val);
-    i = RSTRING_CLEN(val);
+    s = RSTRING_PTR(val);
+    i = RSTRING_LEN(val);
 #if defined(PSTAT_SETCMD)
     if (i > PST_CLEN) {
 	union pstun un;

Modified: MacRuby/trunk/signal.c
===================================================================
--- MacRuby/trunk/signal.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/signal.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -342,7 +342,7 @@
 	goto str_signal;
 
       case T_STRING:
-	s = RSTRING_CPTR(argv[0]);
+	s = RSTRING_PTR(argv[0]);
 	if (s[0] == '-') {
 	    negative++;
 	    s++;
@@ -363,7 +363,7 @@
 
 	    str = rb_check_string_type(argv[0]);
 	    if (!NIL_P(str)) {
-		s = RSTRING_CPTR(str);
+		s = RSTRING_PTR(str);
 		goto str_signal;
 	    }
 	    rb_raise(rb_eArgError, "bad signal type %s",
@@ -731,45 +731,45 @@
 	command = rb_check_string_type(*cmd);
 	if (!NIL_P(command)) {
 	    SafeStringValue(command);	/* taint check */
-	    switch (RSTRING_CLEN(command)) {
+	    switch (RSTRING_LEN(command)) {
 	      case 0:
                 goto sig_ign;
 		break;
               case 14:
-		if (strncmp(RSTRING_CPTR(command), "SYSTEM_DEFAULT", 14) == 0) {
+		if (strncmp(RSTRING_PTR(command), "SYSTEM_DEFAULT", 14) == 0) {
                     func = SIG_DFL;
                     *cmd = 0;
 		}
                 break;
 	      case 7:
-		if (strncmp(RSTRING_CPTR(command), "SIG_IGN", 7) == 0) {
+		if (strncmp(RSTRING_PTR(command), "SIG_IGN", 7) == 0) {
 sig_ign:
                     func = SIG_IGN;
                     *cmd = 0;
 		}
-		else if (strncmp(RSTRING_CPTR(command), "SIG_DFL", 7) == 0) {
+		else if (strncmp(RSTRING_PTR(command), "SIG_DFL", 7) == 0) {
 sig_dfl:
                     func = default_handler(sig);
                     *cmd = 0;
 		}
-		else if (strncmp(RSTRING_CPTR(command), "DEFAULT", 7) == 0) {
+		else if (strncmp(RSTRING_PTR(command), "DEFAULT", 7) == 0) {
                     goto sig_dfl;
 		}
 		break;
 	      case 6:
-		if (strncmp(RSTRING_CPTR(command), "IGNORE", 6) == 0) {
+		if (strncmp(RSTRING_PTR(command), "IGNORE", 6) == 0) {
                     goto sig_ign;
 		}
 		break;
 	      case 4:
-		if (strncmp(RSTRING_CPTR(command), "EXIT", 4) == 0) {
+		if (strncmp(RSTRING_PTR(command), "EXIT", 4) == 0) {
 		    func = sighandler;
 		    *cmd = Qundef;
 		}
 		break;
 	    }
 	    if (func == wrong_trap) {
-		rb_raise(rb_eArgError, "wrong trap - %s", RSTRING_CPTR(command));
+		rb_raise(rb_eArgError, "wrong trap - %s", RSTRING_PTR(command));
 	    }
 	}
 	else {

Modified: MacRuby/trunk/sprintf.c
===================================================================
--- MacRuby/trunk/sprintf.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/sprintf.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -85,7 +85,7 @@
 	bsiz*=2;\
     }\
     rb_str_resize(result, bsiz);\
-    buf = RSTRING_PTR(result);\
+    buf = RSTRING_BYTEPTR(result);\
 } while (0)
 
 #define PUSH(s, l) do { \
@@ -432,13 +432,13 @@
     StringValue(fmt);
     enc = rb_enc_get(fmt);
     fmt = rb_str_new4(fmt);
-    p = RSTRING_PTR(fmt); /* ok */
-    end = p + RSTRING_LEN(fmt);
+    p = RSTRING_BYTEPTR(fmt); /* ok */
+    end = p + RSTRING_BYTELEN(fmt);
     blen = 0;
     bsiz = 120;
     result = rb_str_buf_new(bsiz);
     rb_enc_copy(result, fmt);
-    buf = RSTRING_PTR(result);
+    buf = RSTRING_BYTEPTR(result);
     memset(buf, 0, bsiz);
 
     for (; p < end; p++) {
@@ -560,10 +560,10 @@
 
 		tmp = rb_check_string_type(val);
 		if (!NIL_P(tmp)) {
-		    if (rb_enc_strlen(RSTRING_PTR(tmp),RSTRING_END(tmp),enc) != 1) {
+		    if (rb_enc_strlen(RSTRING_BYTEPTR(tmp),RSTRING_END(tmp),enc) != 1) {
 			rb_raise(rb_eArgError, "%%c requires a character");
 		    }
-		    c = rb_enc_codepoint(RSTRING_PTR(tmp), RSTRING_END(tmp), enc);
+		    c = rb_enc_codepoint(RSTRING_BYTEPTR(tmp), RSTRING_END(tmp), enc);
 		}
 		else {
 		    c = NUM2INT(val);
@@ -601,18 +601,18 @@
 		if (*p == 'p') arg = rb_inspect(arg);
 		str = rb_obj_as_string(arg);
 		if (OBJ_TAINTED(str)) tainted = 1;
-		len = RSTRING_LEN(str);
+		len = RSTRING_BYTELEN(str);
 		enc = rb_enc_check(result, str);
 		if (flags&(FPREC|FWIDTH)) {
-		    slen = rb_enc_strlen(RSTRING_PTR(str),RSTRING_END(str),enc);
+		    slen = rb_enc_strlen(RSTRING_BYTEPTR(str),RSTRING_END(str),enc);
 		    if (slen < 0) {
 			rb_raise(rb_eArgError, "invalid mbstring sequence");
 		    }
 		    if ((flags&FPREC) && (prec < slen)) {
-			char *p = rb_enc_nth(RSTRING_PTR(str), RSTRING_END(str),
+			char *p = rb_enc_nth(RSTRING_BYTEPTR(str), RSTRING_END(str),
 					     prec, enc);
 			slen = prec;
-			len = p - RSTRING_PTR(str);
+			len = p - RSTRING_BYTEPTR(str);
 		    }
 		    /* need to adjust multi-byte string pos */
 		    if ((flags&FWIDTH) && (width > slen)) {
@@ -624,7 +624,7 @@
 			    }
 			}
 			CHECK(len);
-			memcpy(&buf[blen], RSTRING_PTR(str), len);
+			memcpy(&buf[blen], RSTRING_BYTEPTR(str), len);
 			blen += len;
 			if (flags&FMINUS) {
 			    CHECK(width);
@@ -636,7 +636,7 @@
 			break;
 		    }
 		}
-		PUSH(RSTRING_PTR(str), len);
+		PUSH(RSTRING_BYTEPTR(str), len);
 		rb_enc_associate(result, enc);
 	    }
 	    break;
@@ -780,7 +780,7 @@
 		else {
 		    if (sign) {
 			tmp = rb_big2str(val, base);
-			s = RSTRING_PTR(tmp);
+			s = RSTRING_BYTEPTR(tmp);
 			if (s[0] == '-') {
 			    s++;
 			    sc = '-';
@@ -801,7 +801,7 @@
 			    rb_big_2comp(val);
 			}
 			tmp1 = tmp = rb_big2str0(val, base, RBIGNUM_SIGN(val));
-			s = RSTRING_PTR(tmp);
+			s = RSTRING_BYTEPTR(tmp);
 			if (*s == '-') {
 			    dots = 1;
 			    if (base == 10) {
@@ -1041,7 +1041,7 @@
     VALUE result = (VALUE)fp->_bf._base;
     char *buf = (char*)fp->_p;
     size_t len, n;
-    int blen = buf - RSTRING_PTR(result), bsiz = fp->_w;
+    int blen = buf - RSTRING_BYTEPTR(result), bsiz = fp->_w;
 
     if (RBASIC(result)->klass) {
 	rb_raise(rb_eRuntimeError, "rb_vsprintf reentered");
@@ -1079,12 +1079,12 @@
     result = rb_str_buf_new(f._w);
     if (enc) rb_enc_associate(result, enc);
     f._bf._base = (unsigned char *)result;
-    f._p = (unsigned char *)RSTRING_PTR(result);
+    f._p = (unsigned char *)RSTRING_BYTEPTR(result);
     RBASIC(result)->klass = 0;
     f.vwrite = ruby__sfvwrite;
     BSD_vfprintf(&f, fmt, ap);
     RBASIC(result)->klass = rb_cString;
-    rb_str_resize(result, (char *)f._p - RSTRING_PTR(result));
+    rb_str_resize(result, (char *)f._p - RSTRING_BYTEPTR(result));
 
     return result;
 #endif

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/string.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -69,7 +69,7 @@
 
 #define STR_DEC_LEN(str) do {\
     if (STR_EMBED_P(str)) {\
-	long n = RSTRING_LEN(str);\
+	long n = RSTRING_BYTELEN(str);\
 	n--;\
 	STR_SET_EMBED_LEN(str, n);\
     }\
@@ -82,9 +82,9 @@
     if (STR_EMBED_P(str)) {\
 	if ((capacity) > RSTRING_EMBED_LEN_MAX) {\
 	    char *tmp = ALLOC_N(char, capacity+1);\
-	    memcpy(tmp, RSTRING_PTR(str), RSTRING_LEN(str));\
+	    memcpy(tmp, RSTRING_BYTEPTR(str), RSTRING_BYTELEN(str));\
 	    GC_WB(&RSTRING(str)->as.heap.ptr, tmp); \
-	    RSTRING(str)->as.heap.len = RSTRING_LEN(str);\
+	    RSTRING(str)->as.heap.len = RSTRING_BYTELEN(str);\
             STR_SET_NOEMBED(str);\
 	    RSTRING(str)->as.heap.aux.capa = (capacity);\
 	}\
@@ -399,13 +399,13 @@
 	break;
       case ENC_CODERANGE_VALID:
 	if (!rb_enc_asciicompat(STR_ENC_GET(src)) ||
-	    search_nonascii(RSTRING_PTR(dest), RSTRING_END(dest)))
+	    search_nonascii(RSTRING_BYTEPTR(dest), RSTRING_END(dest)))
 	    ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID);
 	else
 	    ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);
 	break;
       default:
-	if (RSTRING_LEN(dest) == 0) {
+	if (RSTRING_BYTELEN(dest) == 0) {
 	    if (!rb_enc_asciicompat(STR_ENC_GET(src)))
 		ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID);
 	    else
@@ -429,7 +429,7 @@
 
     if (cr == ENC_CODERANGE_UNKNOWN) {
 	rb_encoding *enc = STR_ENC_GET(str);
-        cr = coderange_scan(RSTRING_PTR(str), RSTRING_LEN(str), enc);
+        cr = coderange_scan(RSTRING_BYTEPTR(str), RSTRING_BYTELEN(str), enc);
         ENC_CODERANGE_SET(str, cr);
     }
     return cr;
@@ -453,7 +453,7 @@
 {
 #if !WITH_OBJC
     /* TODO */
-    if (RSTRING_PTR(s) != p || RSTRING_LEN(s) != len){
+    if (RSTRING_BYTEPTR(s) != p || RSTRING_BYTELEN(s) != len){
 	rb_raise(rb_eRuntimeError, "string modified");
     }
 #endif
@@ -568,10 +568,10 @@
 	STR_SET_NOEMBED(str);
     }
     if (ptr) {
-	memcpy(RSTRING_PTR(str), ptr, len);
+	memcpy(RSTRING_BYTEPTR(str), ptr, len);
     }
     STR_SET_LEN(str, len);
-    RSTRING_PTR(str)[len] = '\0';
+    RSTRING_BYTEPTR(str)[len] = '\0';
 #endif
     return str;
 }
@@ -641,15 +641,15 @@
 static VALUE
 str_replace_shared(VALUE str2, VALUE str)
 {
-    if (RSTRING_LEN(str) <= RSTRING_EMBED_LEN_MAX) {
+    if (RSTRING_BYTELEN(str) <= RSTRING_EMBED_LEN_MAX) {
 	STR_SET_EMBED(str2);
-	memcpy(RSTRING_PTR(str2), RSTRING_PTR(str), RSTRING_LEN(str)+1);
-	STR_SET_EMBED_LEN(str2, RSTRING_LEN(str));
+	memcpy(RSTRING_BYTEPTR(str2), RSTRING_BYTEPTR(str), RSTRING_BYTELEN(str)+1);
+	STR_SET_EMBED_LEN(str2, RSTRING_BYTELEN(str));
     }
     else {
 	FL_SET(str2, STR_NOEMBED);
-	RSTRING(str2)->as.heap.len = RSTRING_LEN(str);
-	RSTRING(str2)->as.heap.ptr = RSTRING_PTR(str);
+	RSTRING(str2)->as.heap.len = RSTRING_BYTELEN(str);
+	RSTRING(str2)->as.heap.ptr = RSTRING_BYTEPTR(str);
 	RSTRING(str2)->as.heap.aux.shared = str;
 	FL_SET(str2, ELTS_SHARED);
     }
@@ -686,8 +686,8 @@
 
     str2 = str_alloc(klass);
     STR_SET_NOEMBED(str2);
-    RSTRING(str2)->as.heap.len = RSTRING_LEN(str);
-    RSTRING(str2)->as.heap.ptr = RSTRING_PTR(str);
+    RSTRING(str2)->as.heap.len = RSTRING_BYTELEN(str);
+    RSTRING(str2)->as.heap.ptr = RSTRING_BYTEPTR(str);
     if (STR_SHARED_P(str)) {
 	FL_SET(str2, ELTS_SHARED);
 	RSTRING(str2)->as.heap.aux.shared = RSTRING(str)->as.heap.aux.shared;
@@ -710,7 +710,7 @@
     klass = rb_obj_class(orig);
     if (STR_SHARED_P(orig) && (str = RSTRING(orig)->as.heap.aux.shared)) {
 	long ofs;
-	ofs = RSTRING_LEN(str) - RSTRING_LEN(orig);
+	ofs = RSTRING_BYTELEN(str) - RSTRING_BYTELEN(orig);
 	if ((ofs > 0) || (klass != RBASIC(str)->klass) ||
 	    (!OBJ_TAINTED(str) && OBJ_TAINTED(orig))) {
 	    str = str_new3(klass, str);
@@ -721,7 +721,7 @@
 	OBJ_INFECT(str, orig);
     }
     else if (STR_EMBED_P(orig)) {
-	str = str_new(klass, RSTRING_PTR(orig), RSTRING_LEN(orig));
+	str = str_new(klass, RSTRING_BYTEPTR(orig), RSTRING_BYTELEN(orig));
 	rb_enc_cr_str_exact_copy(str, orig);
 	OBJ_INFECT(str, orig);
     }
@@ -836,21 +836,21 @@
     cr = ENC_CODERANGE(str2);
     rb_str_modify(str);
     if (OBJ_TAINTED(str2)) OBJ_TAINT(str);
-    if (RSTRING_LEN(str2) <= RSTRING_EMBED_LEN_MAX) {
+    if (RSTRING_BYTELEN(str2) <= RSTRING_EMBED_LEN_MAX) {
 	STR_SET_EMBED(str);
-	memcpy(RSTRING_PTR(str), RSTRING_PTR(str2), RSTRING_LEN(str2)+1);
-	STR_SET_EMBED_LEN(str, RSTRING_LEN(str2));
+	memcpy(RSTRING_BYTEPTR(str), RSTRING_BYTEPTR(str2), RSTRING_BYTELEN(str2)+1);
+	STR_SET_EMBED_LEN(str, RSTRING_BYTELEN(str2));
         rb_enc_associate(str, enc);
         ENC_CODERANGE_SET(str, cr);
 	return;
     }
     if (!STR_SHARED_P(str) && !STR_EMBED_P(str)) {
-	xfree(RSTRING_PTR(str));
+	xfree(RSTRING_BYTEPTR(str));
     }
     STR_SET_NOEMBED(str);
     STR_UNSET_NOCAPA(str);
-    RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2);
-    RSTRING(str)->as.heap.len = RSTRING_LEN(str2);
+    RSTRING(str)->as.heap.ptr = RSTRING_BYTEPTR(str2);
+    RSTRING(str)->as.heap.len = RSTRING_BYTELEN(str2);
     if (STR_NOCAPA_P(str2)) {
 	FL_SET(str, RBASIC(str2)->flags & STR_NOCAPA);
 	RSTRING(str)->as.heap.aux.shared = RSTRING(str2)->as.heap.aux.shared;
@@ -1009,14 +1009,14 @@
 {
 #if WITH_OBJC
     /* TODO should use CFStringGetMaximumSizeForEncoding too */
-    return RSTRING_CLEN(str);
+    return RSTRING_LEN(str);
 #else
     const char *p, *e;
     int n, cr;
 
-    if (single_byte_optimizable(str)) return RSTRING_LEN(str);
+    if (single_byte_optimizable(str)) return RSTRING_BYTELEN(str);
     if (!enc) enc = STR_ENC_GET(str);
-    p = RSTRING_PTR(str);
+    p = RSTRING_BYTEPTR(str);
     e = RSTRING_END(str);
 #ifdef NONASCII_MASK
     if (ENC_CODERANGE(str) == ENC_CODERANGE_VALID &&
@@ -1102,7 +1102,7 @@
 static VALUE
 rb_str_empty(VALUE str)
 {
-    if (RSTRING_CLEN(str) == 0)
+    if (RSTRING_LEN(str) == 0)
 	return Qtrue;
     return Qfalse;
 }
@@ -1132,11 +1132,11 @@
 
     StringValue(str2);
     enc = rb_enc_check(str1, str2);
-    str3 = rb_str_new(0, RSTRING_LEN(str1)+RSTRING_LEN(str2));
-    memcpy(RSTRING_PTR(str3), RSTRING_PTR(str1), RSTRING_LEN(str1));
-    memcpy(RSTRING_PTR(str3) + RSTRING_LEN(str1),
-	   RSTRING_PTR(str2), RSTRING_LEN(str2));
-    RSTRING_PTR(str3)[RSTRING_LEN(str3)] = '\0';
+    str3 = rb_str_new(0, RSTRING_BYTELEN(str1)+RSTRING_BYTELEN(str2));
+    memcpy(RSTRING_BYTEPTR(str3), RSTRING_BYTEPTR(str1), RSTRING_BYTELEN(str1));
+    memcpy(RSTRING_BYTEPTR(str3) + RSTRING_BYTELEN(str1),
+	   RSTRING_BYTEPTR(str2), RSTRING_BYTELEN(str2));
+    RSTRING_BYTEPTR(str3)[RSTRING_BYTELEN(str3)] = '\0';
 
     if (OBJ_TAINTED(str1) || OBJ_TAINTED(str2))
 	OBJ_TAINT(str3);
@@ -1162,7 +1162,7 @@
     VALUE str2;
     long n, len;
 
-    n = RSTRING_CLEN(str);
+    n = RSTRING_LEN(str);
     len = NUM2LONG(times);
     if (len < 0) {
 	rb_raise(rb_eArgError, "negative argument");
@@ -1178,14 +1178,14 @@
 #else
     str2 = rb_str_new5(str, 0, len *= n);
     if (len) {
-        memcpy(RSTRING_PTR(str2), RSTRING_PTR(str), n);
+        memcpy(RSTRING_BYTEPTR(str2), RSTRING_BYTEPTR(str), n);
         while (n <= len/2) {
-            memcpy(RSTRING_PTR(str2) + n, RSTRING_PTR(str2), n);
+            memcpy(RSTRING_BYTEPTR(str2) + n, RSTRING_BYTEPTR(str2), n);
             n *= 2;
         }
-        memcpy(RSTRING_PTR(str2) + n, RSTRING_PTR(str2), len-n);
+        memcpy(RSTRING_BYTEPTR(str2) + n, RSTRING_BYTEPTR(str2), len-n);
     }
-    RSTRING_PTR(str2)[RSTRING_LEN(str2)] = '\0';
+    RSTRING_BYTEPTR(str2)[RSTRING_BYTELEN(str2)] = '\0';
     OBJ_INFECT(str2, str);
     rb_enc_cr_str_copy_for_substr(str2, str);
 #endif
@@ -1249,11 +1249,11 @@
 str_make_independent(VALUE str)
 {
     char *ptr;
-    long len = RSTRING_LEN(str);
+    long len = RSTRING_BYTELEN(str);
 
     ptr = ALLOC_N(char, len+1);
-    if (RSTRING_PTR(str)) {
-	memcpy(ptr, RSTRING_PTR(str), len);
+    if (RSTRING_BYTEPTR(str)) {
+	memcpy(ptr, RSTRING_BYTEPTR(str), len);
     }
     STR_SET_NOEMBED(str);
     ptr[len] = 0;
@@ -1299,8 +1299,8 @@
 	else if (STR_EMBED_P(str)) {
 	    str_make_independent(str);
 	}
-	else if (RSTRING(str)->as.heap.aux.capa != RSTRING_LEN(str)) {
-	    RESIZE_CAPA(str, RSTRING_LEN(str));
+	else if (RSTRING(str)->as.heap.aux.capa != RSTRING_BYTELEN(str)) {
+	    RESIZE_CAPA(str, RSTRING_BYTELEN(str));
 	}
 	FL_SET(str, STR_ASSOC);
 	RBASIC(add)->klass = 0;
@@ -1335,7 +1335,7 @@
 char *
 rb_string_value_ptr(volatile VALUE *ptr)
 {
-    return (char *)RSTRING_CPTR(rb_string_value(ptr));
+    return (char *)RSTRING_PTR(rb_string_value(ptr));
 }
 
 #if WITH_OBJC
@@ -1377,9 +1377,9 @@
     VALUE str = rb_string_value(ptr);
     return (char *)rb_str_cstr(str);
 #else
-    char *s = RSTRING_PTR(str);
+    char *s = RSTRING_BYTEPTR(str);
 
-    if (!s || RSTRING_LEN(str) != strlen(s)) {
+    if (!s || RSTRING_BYTELEN(str) != strlen(s)) {
 	rb_raise(rb_eArgError, "string contains null byte");
     }
     return s;
@@ -1537,7 +1537,7 @@
     if (single_byte_optimizable(str) || pos < 0)
         return pos;
     else {
-	char *p = RSTRING_PTR(str);
+	char *p = RSTRING_BYTEPTR(str);
         return rb_enc_strlen(p, p + pos, STR_ENC_GET(str));
     }
 #endif
@@ -1603,7 +1603,7 @@
     CFMakeCollectable(substr);
     return (VALUE)substr;
 #else
-    VALUE str2 = rb_str_new5(str, RSTRING_PTR(str)+beg, len);
+    VALUE str2 = rb_str_new5(str, RSTRING_BYTEPTR(str)+beg, len);
 
     rb_enc_cr_str_copy_for_substr(str2, str);
     OBJ_INFECT(str2, str);
@@ -1620,16 +1620,16 @@
 #else
     rb_encoding *enc = STR_ENC_GET(str);
     VALUE str2;
-    char *p, *s = RSTRING_PTR(str), *e = s + RSTRING_LEN(str);
+    char *p, *s = RSTRING_BYTEPTR(str), *e = s + RSTRING_BYTELEN(str);
     int singlebyte = single_byte_optimizable(str);
 
     if (len < 0) return Qnil;
-    if (!RSTRING_LEN(str)) {
+    if (!RSTRING_BYTELEN(str)) {
 	len = 0;
     }
     if (beg < 0) {
 	if (len > -beg) len = -beg;
-	if (-beg * rb_enc_mbmaxlen(enc) < RSTRING_LEN(str) / 8) {
+	if (-beg * rb_enc_mbmaxlen(enc) < RSTRING_BYTELEN(str) / 8) {
 	    beg = -beg;
 	    while (beg-- > len && (e = rb_enc_prev_char(s, e, enc)) != 0);
 	    p = e;
@@ -1670,7 +1670,7 @@
 	len = str_offset(p, e, len, enc, singlebyte);
     }
   sub:
-    if (len > RSTRING_EMBED_LEN_MAX && beg + len == RSTRING_LEN(str)) {
+    if (len > RSTRING_EMBED_LEN_MAX && beg + len == RSTRING_BYTELEN(str)) {
 	str2 = rb_str_new4(str);
 	str2 = str_new3(rb_obj_class(str2), str2);
 	RSTRING(str2)->as.heap.ptr += RSTRING(str2)->as.heap.len - len;
@@ -1708,7 +1708,7 @@
 #else
     if (STR_SHARED_P(str) && RSTRING(str)->as.heap.aux.shared) {
 	VALUE shared = RSTRING(str)->as.heap.aux.shared;
-	if (RSTRING_LEN(shared) == RSTRING_LEN(str)) {
+	if (RSTRING_BYTELEN(shared) == RSTRING_BYTELEN(str)) {
 	    OBJ_FREEZE(shared);
 	    return shared;
 	}
@@ -1751,7 +1751,7 @@
     rb_str_resize(str, len);    
 #else
     STR_SET_LEN(str, len);
-    RSTRING_PTR(str)[len] = '\0';
+    RSTRING_BYTEPTR(str)[len] = '\0';
 #endif
 }
 
@@ -1766,7 +1766,7 @@
 
     rb_str_modify(str);
 #if WITH_OBJC
-    slen = RSTRING_CLEN(str);
+    slen = RSTRING_LEN(str);
     if (slen != len) {
 	void *cfdata;
 
@@ -1777,7 +1777,7 @@
 	    CFDataSetLength((CFMutableDataRef)cfdata, len); 
     }
 #else
-    slen = RSTRING_LEN(str);
+    slen = RSTRING_BYTELEN(str);
     if (len != slen) {
 	if (STR_EMBED_P(str)) {
 	    char *ptr;
@@ -1862,7 +1862,7 @@
     rb_str_modify(str);
     if (STR_ASSOC_P(str)) {
 	FL_UNSET(str, STR_ASSOC);
-	capa = RSTRING(str)->as.heap.aux.capa = RSTRING_LEN(str);
+	capa = RSTRING(str)->as.heap.aux.capa = RSTRING_BYTELEN(str);
     }
     else if (STR_EMBED_P(str)) {
 	capa = RSTRING_EMBED_LEN_MAX;
@@ -1870,16 +1870,16 @@
     else {
 	capa = RSTRING(str)->as.heap.aux.capa;
     }
-    total = RSTRING_LEN(str)+len;
+    total = RSTRING_BYTELEN(str)+len;
     if (capa <= total) {
 	while (total > capa) {
 	    capa = (capa + 1) * 2;
 	}
 	RESIZE_CAPA(str, capa);
     }
-    memcpy(RSTRING_PTR(str) + RSTRING_LEN(str), ptr, len);
+    memcpy(RSTRING_BYTEPTR(str) + RSTRING_BYTELEN(str), ptr, len);
     STR_SET_LEN(str, total);
-    RSTRING_PTR(str)[total] = '\0'; /* sentinel */
+    RSTRING_BYTEPTR(str)[total] = '\0'; /* sentinel */
 #endif
 
     return str;
@@ -1948,7 +1948,7 @@
         if (!rb_enc_asciicompat(str_enc) || !rb_enc_asciicompat(ptr_enc)) {
             if (len == 0)
                 return str;
-            if (RSTRING_LEN(str) == 0) {
+            if (RSTRING_BYTELEN(str) == 0) {
                 rb_str_buf_cat(str, ptr, len);
                 ENCODING_CODERANGE_SET(str, ptr_encindex, ptr_cr);
                 return str;
@@ -2003,8 +2003,8 @@
     if (len < 0) {
 	rb_raise(rb_eArgError, "negative string size (or size too big)");
     }
-    if (ptr >= RSTRING_PTR(str) && ptr <= RSTRING_END(str)) {
-        off = ptr - RSTRING_PTR(str);
+    if (ptr >= RSTRING_BYTEPTR(str) && ptr <= RSTRING_END(str)) {
+        off = ptr - RSTRING_BYTEPTR(str);
     }
     rb_str_modify(str);
     if (len == 0) {
@@ -2013,7 +2013,7 @@
     }
     if (STR_ASSOC_P(str)) {
 	FL_UNSET(str, STR_ASSOC);
-	capa = RSTRING(str)->as.heap.aux.capa = RSTRING_LEN(str);
+	capa = RSTRING(str)->as.heap.aux.capa = RSTRING_BYTELEN(str);
     }
     else if (STR_EMBED_P(str)) {
 	capa = RSTRING_EMBED_LEN_MAX;
@@ -2021,7 +2021,7 @@
     else {
 	capa = RSTRING(str)->as.heap.aux.capa;
     }
-    total = RSTRING_LEN(str)+len;
+    total = RSTRING_BYTELEN(str)+len;
     if (capa <= total) {
 	while (total > capa) {
 	    capa = (capa + 1) * 2;
@@ -2029,11 +2029,11 @@
 	RESIZE_CAPA(str, capa);
     }
     if (off != -1) {
-        ptr = RSTRING_PTR(str) + off;
+        ptr = RSTRING_BYTEPTR(str) + off;
     }
-    memcpy(RSTRING_PTR(str) + RSTRING_LEN(str), ptr, len);
+    memcpy(RSTRING_BYTEPTR(str) + RSTRING_BYTELEN(str), ptr, len);
     STR_SET_LEN(str, total);
-    RSTRING_PTR(str)[total] = '\0'; // sentinel
+    RSTRING_BYTEPTR(str)[total] = '\0'; // sentinel
 
     ENCODING_CODERANGE_SET(str, res_encindex, res_cr);
     return str;
@@ -2089,7 +2089,7 @@
     CFDataRef data;
     long str2len;
 
-    str2len = RSTRING_CLEN(str2);
+    str2len = RSTRING_LEN(str2);
 
     if (str2len == 0)
 	return str;
@@ -2117,7 +2117,7 @@
 
     str2_cr = ENC_CODERANGE(str2);
 
-    rb_enc_cr_str_buf_cat(str, RSTRING_PTR(str2), RSTRING_LEN(str2),
+    rb_enc_cr_str_buf_cat(str, RSTRING_BYTEPTR(str2), RSTRING_BYTELEN(str2),
         ENCODING_GET(str2), str2_cr, &str2_cr);
 
     OBJ_INFECT(str, str2);
@@ -2132,11 +2132,11 @@
 {
     StringValue(str2);
 #if !WITH_OBJC
-    if (RSTRING_LEN(str2) > 0 && STR_ASSOC_P(str)) {
+    if (RSTRING_BYTELEN(str2) > 0 && STR_ASSOC_P(str)) {
 	rb_encoding *enc;
 	int cr, cr2;
 
-        long len = RSTRING_LEN(str)+RSTRING_LEN(str2);
+        long len = RSTRING_BYTELEN(str)+RSTRING_BYTELEN(str2);
         enc = rb_enc_check(str, str2);
         cr = ENC_CODERANGE(str);
         if ((cr2 = ENC_CODERANGE(str2)) > cr) cr = cr2;
@@ -2144,7 +2144,7 @@
         REALLOC_N(RSTRING(str)->as.heap.ptr, char, len+1);
 	GC_WB(&RSTRING(str)->as.heap.ptr, RSTRING(str)->as.heap.ptr);
         memcpy(RSTRING(str)->as.heap.ptr + RSTRING(str)->as.heap.len,
-               RSTRING_PTR(str2), RSTRING_LEN(str2)+1);
+               RSTRING_BYTEPTR(str2), RSTRING_BYTELEN(str2)+1);
         RSTRING(str)->as.heap.len = len;
         rb_enc_associate(str, enc);
         ENC_CODERANGE_SET(str, cr);
@@ -2189,12 +2189,12 @@
 #else
 	rb_encoding *enc = STR_ENC_GET(str1);
 	int c = FIX2INT(str2);
-	int pos = RSTRING_LEN(str1);
+	int pos = RSTRING_BYTELEN(str1);
 	int len = rb_enc_codelen(c, enc);
 	int cr = ENC_CODERANGE(str1);
 
 	rb_str_resize(str1, pos+len);
-	rb_enc_mbcput(c, RSTRING_PTR(str1)+pos, enc);
+	rb_enc_mbcput(c, RSTRING_BYTEPTR(str1)+pos, enc);
 	ENC_CODERANGE_SET(str1, cr);
 #endif
 	return str1;
@@ -2331,7 +2331,7 @@
 int
 rb_str_hash(VALUE str)
 {
-    return hash((const void *)RSTRING_PTR(str), RSTRING_LEN(str), 0);
+    return hash((const void *)RSTRING_BYTEPTR(str), RSTRING_BYTELEN(str), 0);
 }
 
 int
@@ -2340,8 +2340,8 @@
     int len;
 
     if (!rb_str_comparable(str1, str2)) return 1;
-    if (RSTRING_LEN(str1) == (len = RSTRING_LEN(str2)) &&
-	memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len) == 0) {
+    if (RSTRING_BYTELEN(str1) == (len = RSTRING_BYTELEN(str2)) &&
+	memcmp(RSTRING_BYTEPTR(str1), RSTRING_BYTEPTR(str2), len) == 0) {
 	return 0;
     }
     return 1;
@@ -2428,10 +2428,10 @@
     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);
+    len = lesser(RSTRING_BYTELEN(str1), RSTRING_BYTELEN(str2));
+    retval = memcmp(RSTRING_BYTEPTR(str1), RSTRING_BYTEPTR(str2), len);
     if (retval == 0) {
-	if (RSTRING_LEN(str1) == RSTRING_LEN(str2)) {
+	if (RSTRING_BYTELEN(str1) == RSTRING_BYTELEN(str2)) {
 	    if (!enc) {
 		if (ENCODING_GET(str1) - ENCODING_GET(str2) > 0)
 		    return 1;
@@ -2439,7 +2439,7 @@
 	    }
 	    return 0;
 	}
-	if (RSTRING_LEN(str1) > RSTRING_LEN(str2)) return 1;
+	if (RSTRING_BYTELEN(str1) > RSTRING_BYTELEN(str2)) return 1;
 	return -1;
     }
     if (retval > 0) return 1;
@@ -2473,11 +2473,11 @@
 	return rb_equal(str2, str1);
     }
 #if WITH_OBJC
-    len = RSTRING_CLEN(str1);
-    if (len != RSTRING_CLEN(str2))
+    len = RSTRING_LEN(str1);
+    if (len != RSTRING_LEN(str2))
 	return Qfalse;
     if (rb_str_cfdata2(str1) != NULL || rb_str_cfdata2(str2) != NULL)
-	return memcmp(RSTRING_CPTR(str1), RSTRING_CPTR(str2), len) == 0 ? Qtrue : Qfalse;
+	return memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len) == 0 ? Qtrue : Qfalse;
     if (!rb_objc_str_is_pure(str2)) {
 	/* This is to work around a strange bug in CFEqual's objc 
 	 * dispatching.
@@ -2490,8 +2490,8 @@
 	return Qtrue;
 #else
     if (!rb_str_comparable(str1, str2)) return Qfalse;
-    if (RSTRING_LEN(str1) == (len = RSTRING_LEN(str2)) &&
-	memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len) == 0) {
+    if (RSTRING_BYTELEN(str1) == (len = RSTRING_BYTELEN(str2)) &&
+	memcmp(RSTRING_BYTEPTR(str1), RSTRING_BYTEPTR(str2), len) == 0) {
 	return Qtrue;
     }
 #endif
@@ -2509,7 +2509,7 @@
 static VALUE
 rb_str_eql(VALUE str1, VALUE str2)
 {
-    if (TYPE(str2) != T_STRING || RSTRING_LEN(str1) != RSTRING_LEN(str2))
+    if (TYPE(str2) != T_STRING || RSTRING_BYTELEN(str1) != RSTRING_BYTELEN(str2))
 	return Qfalse;
 
 #if WITH_OBJC
@@ -2517,8 +2517,8 @@
 	return Qtrue;
 #else
     if (!rb_str_comparable(str1, str2)) return Qfalse;
-    if (memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2),
-	       lesser(RSTRING_LEN(str1), RSTRING_LEN(str2))) == 0)
+    if (memcmp(RSTRING_BYTEPTR(str1), RSTRING_BYTEPTR(str2),
+	       lesser(RSTRING_BYTELEN(str1), RSTRING_BYTELEN(str2))) == 0)
 	return Qtrue;
 #endif
 
@@ -2605,8 +2605,8 @@
 	return Qnil;
     }
 
-    p1 = RSTRING_PTR(str1); p1end = RSTRING_END(str1);
-    p2 = RSTRING_PTR(str2); p2end = RSTRING_END(str2);
+    p1 = RSTRING_BYTEPTR(str1); p1end = RSTRING_END(str1);
+    p2 = RSTRING_BYTEPTR(str2); p2end = RSTRING_END(str2);
     while (p1 < p1end && p2 < p2end) {
 	int c1 = rb_enc_codepoint(p1, p1end, enc);
 	int c2 = rb_enc_codepoint(p2, p2end, enc);
@@ -2621,8 +2621,8 @@
 	p1 += len;
 	p2 += len;
     }
-    if (RSTRING_LEN(str1) == RSTRING_LEN(str2)) return INT2FIX(0);
-    if (RSTRING_LEN(str1) > RSTRING_LEN(str2)) return INT2FIX(1);
+    if (RSTRING_BYTELEN(str1) == RSTRING_BYTELEN(str2)) return INT2FIX(0);
+    if (RSTRING_BYTELEN(str1) > RSTRING_BYTELEN(str2)) return INT2FIX(1);
     return INT2FIX(-1);
 #endif
 }
@@ -2655,16 +2655,16 @@
 	if (offset < 0) return -1;
     }
     if (len - offset < slen) return -1;
-    s = RSTRING_PTR(str);
+    s = RSTRING_BYTEPTR(str);
     if (offset) {
 	offset = str_offset(s, RSTRING_END(str), offset, enc, single_byte_optimizable(str));
 	s += offset;
     }
     if (slen == 0) return offset;
     /* need proceed one character at a time */
-    sptr = RSTRING_PTR(sub);
-    slen = RSTRING_LEN(sub);
-    len = RSTRING_LEN(str) - offset;
+    sptr = RSTRING_BYTEPTR(sub);
+    slen = RSTRING_BYTELEN(sub);
+    len = RSTRING_BYTELEN(str) - offset;
     for (;;) {
 	char *t;
 	pos = rb_memsearch(sptr, slen, s, len);
@@ -2755,8 +2755,8 @@
 #if WITH_OBJC
     CFRange r;
     long sublen, strlen;
-    sublen = RSTRING_CLEN(sub);
-    strlen = RSTRING_CLEN(str);
+    sublen = RSTRING_LEN(sub);
+    strlen = RSTRING_LEN(str);
     if (sublen == 0 && strlen == 0)
 	return 0;
     if (pos <= sublen) {
@@ -2788,10 +2788,10 @@
     if (len == 0) {
 	return pos;
     }
-    sbeg = RSTRING_PTR(str);
+    sbeg = RSTRING_BYTEPTR(str);
     e = RSTRING_END(str);
-    t = RSTRING_PTR(sub);
-    slen = RSTRING_LEN(sub);
+    t = RSTRING_BYTEPTR(sub);
+    slen = RSTRING_BYTELEN(sub);
     for (;;) {
 	s = str_nth(sbeg, e, pos, enc, singlebyte);
 	if (!s) return -1;
@@ -3195,16 +3195,16 @@
     char carry[ONIGENC_CODE_TO_MBC_MAXLEN] = "\1";
     int carry_pos = 0, carry_len = 1;
 
-    str = rb_str_new5(orig, RSTRING_CPTR(orig), RSTRING_CLEN(orig));
+    str = rb_str_new5(orig, RSTRING_PTR(orig), RSTRING_LEN(orig));
 #if !WITH_OBJC
     rb_enc_cr_str_copy_for_substr(str, orig);
     OBJ_INFECT(str, orig);
 #endif
-    if (RSTRING_CLEN(str) == 0) return str;
+    if (RSTRING_LEN(str) == 0) return str;
 
     enc = STR_ENC_GET(orig);
-    sbeg = RSTRING_PTR(str);
-    s = e = sbeg + RSTRING_LEN(str);
+    sbeg = RSTRING_BYTEPTR(str);
+    s = e = sbeg + RSTRING_BYTELEN(str);
 
     while ((s = rb_enc_prev_char(sbeg, s, enc)) != 0) {
         enum neighbor_char neighbor;
@@ -3243,18 +3243,18 @@
     }
 #if WITH_OBJC
     CFMutableDataRef data = (CFMutableDataRef)rb_str_cfdata(str);
-    CFDataSetLength(data, RSTRING_LEN(str) + carry_len);
+    CFDataSetLength(data, RSTRING_BYTELEN(str) + carry_len);
     s = (char *)CFDataGetMutableBytePtr(data);
-    memmove(s + carry_len, s, RSTRING_LEN(str) - carry_pos);
+    memmove(s + carry_len, s, RSTRING_BYTELEN(str) - carry_pos);
     memmove(s, carry, carry_len);
     RSTRING_SYNC(str);
 #else
-    RESIZE_CAPA(str, RSTRING_LEN(str) + carry_len);
-    s = RSTRING_PTR(str) + carry_pos;
-    memmove(s + carry_len, s, RSTRING_LEN(str) - carry_pos);
+    RESIZE_CAPA(str, RSTRING_BYTELEN(str) + carry_len);
+    s = RSTRING_BYTEPTR(str) + carry_pos;
+    memmove(s + carry_len, s, RSTRING_BYTELEN(str) - carry_pos);
     memmove(s, carry, carry_len);
-    STR_SET_LEN(str, RSTRING_LEN(str) + carry_len);
-    RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+    STR_SET_LEN(str, RSTRING_BYTELEN(str) + carry_len);
+    RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)] = '\0';
     rb_enc_str_coderange(str);
 #endif
     return str;
@@ -3317,7 +3317,7 @@
     succ = rb_intern("succ");
     StringValue(end);
 #if WITH_OBJC
-    if (RSTRING_CLEN(beg) == 1 && RSTRING_CLEN(end) == 1) {
+    if (RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1) {
 	UniChar c = CFStringGetCharacterAtIndex((CFStringRef)beg, 0);
 	UniChar e = CFStringGetCharacterAtIndex((CFStringRef)end, 0);
 	
@@ -3338,10 +3338,10 @@
 	return beg;
 #else
     enc = rb_enc_check(beg, end);
-    if (RSTRING_CLEN(beg) == 1 && RSTRING_CLEN(end) == 1 &&
+    if (RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1 &&
 	is_ascii_string(beg) && is_ascii_string(end)) {
-	char c = RSTRING_CPTR(beg)[0];
-	char e = RSTRING_CPTR(end)[0];
+	char c = RSTRING_PTR(beg)[0];
+	char e = RSTRING_PTR(end)[0];
 
 	if (c > e || (excl && c == e)) return beg;
 	for (;;) {
@@ -3364,7 +3364,7 @@
 	current = rb_funcall(current, succ, 0, 0);
 	StringValue(current);
 	if (excl && rb_str_equal(current, end)) break;
-	if (RSTRING_CLEN(current) > RSTRING_CLEN(end) || RSTRING_CLEN(current) == 0)
+	if (RSTRING_LEN(current) > RSTRING_LEN(end) || RSTRING_LEN(current) == 0)
 	    break;
     }
 
@@ -3391,7 +3391,7 @@
 
       num_index:
 	str = rb_str_substr(str, idx, 1);
-	if (!NIL_P(str) && RSTRING_CLEN(str) == 0) return Qnil;
+	if (!NIL_P(str) && RSTRING_LEN(str) == 0) return Qnil;
 	return str;
 
       case T_REGEXP:
@@ -3496,25 +3496,25 @@
     CFStringReplace((CFMutableStringRef)str, CFRangeMake(beg, len), 
 	(CFStringRef)val);
 #else
-    if (len < RSTRING_LEN(val)) {
+    if (len < RSTRING_BYTELEN(val)) {
 	/* expand string */
-	RESIZE_CAPA(str, RSTRING_LEN(str) + RSTRING_LEN(val) - len + 1);
+	RESIZE_CAPA(str, RSTRING_BYTELEN(str) + RSTRING_BYTELEN(val) - len + 1);
     }
 
-    if (RSTRING_LEN(val) != len) {
-	memmove(RSTRING_PTR(str) + beg + RSTRING_LEN(val),
-		RSTRING_PTR(str) + beg + len,
-		RSTRING_LEN(str) - (beg + len));
+    if (RSTRING_BYTELEN(val) != len) {
+	memmove(RSTRING_BYTEPTR(str) + beg + RSTRING_BYTELEN(val),
+		RSTRING_BYTEPTR(str) + beg + len,
+		RSTRING_BYTELEN(str) - (beg + len));
     }
-    if (RSTRING_LEN(val) < beg && len < 0) {
-	MEMZERO(RSTRING_PTR(str) + RSTRING_LEN(str), char, -len);
+    if (RSTRING_BYTELEN(val) < beg && len < 0) {
+	MEMZERO(RSTRING_BYTEPTR(str) + RSTRING_BYTELEN(str), char, -len);
     }
-    if (RSTRING_LEN(val) > 0) {
-	memmove(RSTRING_PTR(str)+beg, RSTRING_PTR(val), RSTRING_LEN(val));
+    if (RSTRING_BYTELEN(val) > 0) {
+	memmove(RSTRING_BYTEPTR(str)+beg, RSTRING_BYTEPTR(val), RSTRING_BYTELEN(val));
     }
-    STR_SET_LEN(str, RSTRING_LEN(str) + RSTRING_LEN(val) - len);
-    if (RSTRING_PTR(str)) {
-	RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+    STR_SET_LEN(str, RSTRING_BYTELEN(str) + RSTRING_BYTELEN(val) - len);
+    if (RSTRING_BYTEPTR(str)) {
+	RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)] = '\0';
     }
     OBJ_INFECT(str, val);
 #endif
@@ -3557,12 +3557,12 @@
 #if WITH_OBJC
     rb_str_splice_0(str, beg, len, val);
 #else
-    p = str_nth(RSTRING_PTR(str), RSTRING_END(str), beg, enc, singlebyte);
+    p = str_nth(RSTRING_BYTEPTR(str), RSTRING_END(str), beg, enc, singlebyte);
     if (!p) p = RSTRING_END(str);
     e = str_nth(p, RSTRING_END(str), len, enc, singlebyte);
     if (!e) e = RSTRING_END(str);
     /* error check */
-    beg = p - RSTRING_PTR(str);	/* physical position */
+    beg = p - RSTRING_BYTEPTR(str);	/* physical position */
     len = e - p;		/* physical length */
     rb_str_splice_0(str, beg, len, val);
     rb_enc_associate(str, enc);
@@ -3845,7 +3845,7 @@
 
 	if (iter || !NIL_P(hash)) {
 #if !WITH_OBJC
-	    char *p = RSTRING_PTR(str); long len = RSTRING_LEN(str);
+	    char *p = RSTRING_BYTEPTR(str); long len = RSTRING_BYTELEN(str);
 #endif
 
             if (iter) {
@@ -3869,9 +3869,9 @@
         enc = rb_enc_compatible(str, repl);
         if (!enc) {
             rb_encoding *str_enc = STR_ENC_GET(str);
-            if (coderange_scan(RSTRING_PTR(str), BEG(0), str_enc) != ENC_CODERANGE_7BIT ||
-                coderange_scan(RSTRING_PTR(str)+END(0),
-			       RSTRING_LEN(str)-END(0), str_enc) != ENC_CODERANGE_7BIT) {
+            if (coderange_scan(RSTRING_BYTEPTR(str), BEG(0), str_enc) != ENC_CODERANGE_7BIT ||
+                coderange_scan(RSTRING_BYTEPTR(str)+END(0),
+			       RSTRING_BYTELEN(str)-END(0), str_enc) != ENC_CODERANGE_7BIT) {
                 rb_raise(rb_eArgError, "character encodings differ: %s and %s",
 			 rb_enc_name(str_enc),
 			 rb_enc_name(STR_ENC_GET(repl)));
@@ -3892,18 +3892,18 @@
 	    if (cr2 == ENC_CODERANGE_UNKNOWN || cr2 > cr) cr = cr2;
 	}
 	plen = END(0) - BEG(0);
-	if (RSTRING_LEN(repl) > plen) {
-	    RESIZE_CAPA(str, RSTRING_LEN(str) + RSTRING_LEN(repl) - plen);
+	if (RSTRING_BYTELEN(repl) > plen) {
+	    RESIZE_CAPA(str, RSTRING_BYTELEN(str) + RSTRING_BYTELEN(repl) - plen);
 	}
-	if (RSTRING_LEN(repl) != plen) {
-	    memmove(RSTRING_PTR(str) + BEG(0) + RSTRING_LEN(repl),
-		    RSTRING_PTR(str) + BEG(0) + plen,
-		    RSTRING_LEN(str) - BEG(0) - plen);
+	if (RSTRING_BYTELEN(repl) != plen) {
+	    memmove(RSTRING_BYTEPTR(str) + BEG(0) + RSTRING_BYTELEN(repl),
+		    RSTRING_BYTEPTR(str) + BEG(0) + plen,
+		    RSTRING_BYTELEN(str) - BEG(0) - plen);
 	}
-	memcpy(RSTRING_PTR(str) + BEG(0),
-	       RSTRING_PTR(repl), RSTRING_LEN(repl));
-	STR_SET_LEN(str, RSTRING_LEN(str) + RSTRING_LEN(repl) - plen);
-	RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+	memcpy(RSTRING_BYTEPTR(str) + BEG(0),
+	       RSTRING_BYTEPTR(repl), RSTRING_BYTELEN(repl));
+	STR_SET_LEN(str, RSTRING_BYTELEN(str) + RSTRING_BYTELEN(repl) - plen);
+	RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)] = '\0';
 	ENC_CODERANGE_SET(str, cr);
 #endif
 	if (tainted) OBJ_TAINT(str);
@@ -3992,15 +3992,15 @@
 
 #if WITH_OBJC
     dest = rb_str_new5(str, NULL, 0);
-    slen = RSTRING_CLEN(str);
-    sp = RSTRING_CPTR(str);
+    slen = RSTRING_LEN(str);
+    sp = RSTRING_PTR(str);
     cp = sp;
     str_enc = NULL;
 #else
-    blen = RSTRING_LEN(str) + 30; /* len + margin */
+    blen = RSTRING_BYTELEN(str) + 30; /* len + margin */
     dest = rb_str_buf_new(blen);
-    sp = RSTRING_PTR(str);
-    slen = RSTRING_LEN(str);
+    sp = RSTRING_BYTEPTR(str);
+    slen = RSTRING_BYTELEN(str);
     cp = sp;
     str_enc = STR_ENC_GET(str);
 #endif
@@ -4178,17 +4178,17 @@
 	OBJ_TAINT(str);
 #else
     StringValue(str2);
-    len = RSTRING_LEN(str2);
+    len = RSTRING_BYTELEN(str2);
     if (STR_ASSOC_P(str2)) {
 	str2 = rb_str_new4(str2);
     }
     if (STR_SHARED_P(str2)) {
 	if (str_independent(str) && !STR_EMBED_P(str)) {
-	    xfree(RSTRING_PTR(str));
+	    xfree(RSTRING_BYTEPTR(str));
 	}
 	STR_SET_NOEMBED(str);
 	RSTRING(str)->as.heap.len = len;
-	RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2);
+	RSTRING(str)->as.heap.ptr = RSTRING_BYTEPTR(str2);
 	FL_SET(str, ELTS_SHARED);
 	FL_UNSET(str, STR_ASSOC);
 	RSTRING(str)->as.heap.aux.shared = RSTRING(str2)->as.heap.aux.shared;
@@ -4224,11 +4224,11 @@
 #else
     /* rb_str_modify() */	/* no need for str_make_independent */
     if (str_independent(str) && !STR_EMBED_P(str)) {
-	free(RSTRING_PTR(str));
+	free(RSTRING_BYTEPTR(str));
     }
     STR_SET_EMBED(str);
     STR_SET_EMBED_LEN(str, 0);
-    RSTRING_PTR(str)[0] = 0;
+    RSTRING_BYTEPTR(str)[0] = 0;
     ENC_CODERANGE_CLEAR(str);
 #endif
     return str;
@@ -4260,14 +4260,14 @@
 rb_str_getbyte(VALUE str, VALUE index)
 {
     long pos = NUM2LONG(index);
-    long n = RSTRING_LEN(str);
+    long n = RSTRING_BYTELEN(str);
 
     if (pos < 0)
         pos += n;
     if (pos < 0 || n <= pos)
         return Qnil;
 
-    return INT2FIX((unsigned char)RSTRING_PTR(str)[pos]);
+    return INT2FIX((unsigned char)RSTRING_BYTEPTR(str)[pos]);
 }
 
 /*
@@ -4281,7 +4281,7 @@
 {
     long pos = NUM2LONG(index);
     int byte = NUM2INT(value);
-    long n = RSTRING_LEN(str);
+    long n = RSTRING_BYTELEN(str);
 
     rb_str_modify(str);
 
@@ -4290,7 +4290,7 @@
     if (pos < 0)
         pos += n;
 
-    RSTRING_PTR(str)[pos] = byte;
+    RSTRING_BYTEPTR(str)[pos] = byte;
 #if WITH_OBJC
     RSTRING_SYNC(str);
 #endif
@@ -4329,9 +4329,9 @@
 #else
     char *s, *e, c;
 
-    if (RSTRING_LEN(str) > 1) {
+    if (RSTRING_BYTELEN(str) > 1) {
 	rb_str_modify(str);
-	s = RSTRING_PTR(str);
+	s = RSTRING_BYTEPTR(str);
 	e = RSTRING_END(str) - 1;
 
 	if (single_byte_optimizable(str)) {
@@ -4370,13 +4370,13 @@
     VALUE obj;
     char *s, *e, *p;
 
-    if (RSTRING_LEN(str) <= 1) return rb_str_dup(str);
+    if (RSTRING_BYTELEN(str) <= 1) return rb_str_dup(str);
     enc = STR_ENC_GET(str);
-    obj = rb_str_new5(str, 0, RSTRING_LEN(str));
-    s = RSTRING_PTR(str); e = RSTRING_END(str);
+    obj = rb_str_new5(str, 0, RSTRING_BYTELEN(str));
+    s = RSTRING_BYTEPTR(str); e = RSTRING_END(str);
     p = RSTRING_END(obj);
 
-    if (RSTRING_LEN(str) > 1) {
+    if (RSTRING_BYTELEN(str) > 1) {
 	if (single_byte_optimizable(str)) {
 	    while (s < e) {
 		*--p = *s++;
@@ -4392,7 +4392,7 @@
 	    }
 	}
     }
-    STR_SET_LEN(obj, RSTRING_LEN(str));
+    STR_SET_LEN(obj, RSTRING_BYTELEN(str));
     OBJ_INFECT(obj, str);
     rb_enc_cr_str_copy_for_substr(obj, str);
 
@@ -4555,17 +4555,17 @@
 
 #if WITH_OBJC
     if (rb_objc_str_is_bytestring(str)) {
-	p = (const char *)RSTRING_PTR(str); 
+	p = (const char *)RSTRING_BYTEPTR(str); 
 	pend = (const char *)RSTRING_END(str);
     }
     else {
-	p = RSTRING_CPTR(str); 
-	pend = p + RSTRING_CLEN(str);
+	p = RSTRING_PTR(str); 
+	pend = p + RSTRING_LEN(str);
     }
     if (p == NULL)
 	return rb_str_new2("\"\"");
 #else
-    p = RSTRING_PTR(str); pend = RSTRING_END(str);
+    p = RSTRING_BYTEPTR(str); pend = RSTRING_END(str);
 #endif
     result = rb_str_buf_new2("");
 #if !WITH_OBJC
@@ -4679,15 +4679,15 @@
     len = 2;			/* "" */
 #if WITH_OBJC
     if (rb_objc_str_is_bytestring(str)) {
-	p = RSTRING_PTR(str); 
+	p = RSTRING_BYTEPTR(str); 
 	pend = RSTRING_END(str);
     }
     else {
-	p = RSTRING_CPTR(str); 
-	pend = p + RSTRING_CLEN(str);
+	p = RSTRING_PTR(str); 
+	pend = p + RSTRING_LEN(str);
     }
 #else
-    p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str);
+    p = RSTRING_BYTEPTR(str); pend = p + RSTRING_BYTELEN(str);
 #endif
     while (p < pend) {
 	unsigned char c = *p++;
@@ -4719,8 +4719,8 @@
     }
 
     result = rb_str_new5(str, 0, len);
-    p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str);
-    q = RSTRING_PTR(result); qend = q + len;
+    p = RSTRING_BYTEPTR(str); pend = p + RSTRING_BYTELEN(str);
+    q = RSTRING_BYTEPTR(result); qend = q + len;
 
     *q++ = '"';
     while (p < pend) {
@@ -4821,7 +4821,7 @@
 
     rb_str_modify(str);
     enc = STR_ENC_GET(str);
-    s = RSTRING_PTR(str); send = RSTRING_END(str);
+    s = RSTRING_BYTEPTR(str); send = RSTRING_END(str);
     while (s < send) {
 	int c = rb_enc_codepoint(s, send, enc);
 
@@ -4889,7 +4889,7 @@
 
     rb_str_modify(str);
     enc = STR_ENC_GET(str);
-    s = RSTRING_PTR(str); send = RSTRING_END(str);
+    s = RSTRING_BYTEPTR(str); send = RSTRING_END(str);
     while (s < send) {
 	int c = rb_enc_codepoint(s, send, enc);
 
@@ -4984,8 +4984,8 @@
 
     rb_str_modify(str);
     enc = STR_ENC_GET(str);
-    if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil;
-    s = RSTRING_PTR(str); send = RSTRING_END(str);
+    if (RSTRING_BYTELEN(str) == 0 || !RSTRING_BYTEPTR(str)) return Qnil;
+    s = RSTRING_BYTEPTR(str); send = RSTRING_END(str);
 
     c = rb_enc_codepoint(s, send, enc);
     if (rb_enc_islower(c, enc)) {
@@ -5084,7 +5084,7 @@
 
     rb_str_modify(str);
     enc = STR_ENC_GET(str);
-    s = RSTRING_PTR(str); send = RSTRING_END(str);
+    s = RSTRING_BYTEPTR(str); send = RSTRING_END(str);
     while (s < send) {
 	int c = rb_enc_codepoint(s, send, enc);
 
@@ -5199,7 +5199,7 @@
 
 	StringValue(s);
 
-	sptr = RSTRING_CPTR(s);
+	sptr = RSTRING_PTR(s);
 	exclude = sptr[0] == '^';
 
 	p = NULL;
@@ -5375,7 +5375,7 @@
     else {
 	CFStringReplace(str, *result_range, substr);
 	search_range->location = result_range->location + 1;
-	search_range->length = RSTRING_CLEN(str) - search_range->location;
+	search_range->length = RSTRING_LEN(str) - search_range->location;
     }	    
 }
 
@@ -5491,14 +5491,14 @@
     StringValue(src);
     StringValue(repl);
     
-    if (RSTRING_CLEN(str) == 0)
+    if (RSTRING_LEN(str) == 0)
        return Qnil;
   
     rb_str_modify(str);
 
     _ctx.orepl = repl; 
-    _ctx.src = RSTRING_CPTR(src);
-    _ctx.repl = RSTRING_CPTR(repl);
+    _ctx.src = RSTRING_PTR(src);
+    _ctx.repl = RSTRING_PTR(repl);
 
     /* TODO: support non-8-bit src/repl */
     assert(_ctx.src != NULL && _ctx.repl != NULL);
@@ -5527,13 +5527,13 @@
 
     StringValue(src);
     StringValue(repl);
-    if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil;
-    trsrc.p = RSTRING_PTR(src); trsrc.pend = trsrc.p + RSTRING_LEN(src);
-    if (RSTRING_LEN(src) >= 2 && RSTRING_PTR(src)[0] == '^') {
+    if (RSTRING_BYTELEN(str) == 0 || !RSTRING_BYTEPTR(str)) return Qnil;
+    trsrc.p = RSTRING_BYTEPTR(src); trsrc.pend = trsrc.p + RSTRING_BYTELEN(src);
+    if (RSTRING_BYTELEN(src) >= 2 && RSTRING_BYTEPTR(src)[0] == '^') {
 	cflag++;
 	trsrc.p++;
     }
-    if (RSTRING_LEN(repl) == 0) {
+    if (RSTRING_BYTELEN(repl) == 0) {
 	return rb_str_delete_bang(1, &src, str);
     }
     e1 = rb_enc_check(str, src);
@@ -5544,8 +5544,8 @@
     else {
 	enc = rb_enc_check(src, repl);
     }
-    trrepl.p = RSTRING_PTR(repl);
-    trrepl.pend = trrepl.p + RSTRING_LEN(repl);
+    trrepl.p = RSTRING_BYTEPTR(repl);
+    trrepl.pend = trrepl.p + RSTRING_BYTELEN(repl);
     trsrc.gen = trrepl.gen = 0;
     trsrc.now = trrepl.now = 0;
     trsrc.max = trrepl.max = 0;
@@ -5592,9 +5592,9 @@
     }
 
     rb_str_modify(str);
-    s = RSTRING_PTR(str); send = RSTRING_END(str);
+    s = RSTRING_BYTEPTR(str); send = RSTRING_END(str);
     if (sflag) {
-	int clen, tlen, max = RSTRING_LEN(str);
+	int clen, tlen, max = RSTRING_BYTELEN(str);
 	int offset, save = -1;
 	char *buf = ALLOC_N(char, max), *t = buf;
 	VALUE v;
@@ -5660,7 +5660,7 @@
 	}
     }
     else {
-	int clen, tlen, max = RSTRING_LEN(str) * 1.2;
+	int clen, tlen, max = RSTRING_BYTELEN(str) * 1.2;
 	int offset;
 	char *buf = ALLOC_N(char, max), *t = buf;
 	VALUE v;
@@ -5769,10 +5769,10 @@
     VALUE table = 0, ptable = 0;
     int i, cflag = 0;
 
-    tr.p = RSTRING_PTR(str); tr.pend = tr.p + RSTRING_LEN(str);
+    tr.p = RSTRING_BYTEPTR(str); tr.pend = tr.p + RSTRING_BYTELEN(str);
     tr.gen = tr.now = tr.max = 0;
     
-    if (RSTRING_LEN(str) > 1 && rb_enc_ascget(tr.p, tr.pend, &l, enc) == '^') {
+    if (RSTRING_BYTELEN(str) > 1 && rb_enc_ascget(tr.p, tr.pend, &l, enc) == '^') {
 	cflag = 1;
 	tr.p += l;
     }
@@ -5892,8 +5892,8 @@
     }
 
     rb_str_modify(str);
-    s = t = RSTRING_PTR(str);
-    if (!s || RSTRING_LEN(str) == 0) return Qnil;
+    s = t = RSTRING_BYTEPTR(str);
+    if (!s || RSTRING_BYTELEN(str) == 0) return Qnil;
     send = RSTRING_END(str);
     while (s < send) {
 	int c = rb_enc_codepoint(s, send, enc);
@@ -5909,7 +5909,7 @@
 	s += clen;
     }
     *t = '\0';
-    STR_SET_LEN(str, t - RSTRING_PTR(str));
+    STR_SET_LEN(str, t - RSTRING_BYTEPTR(str));
 
     ENC_CODERANGE_SET(str, cr);
     if (modify) return str;
@@ -6005,8 +6005,8 @@
     }
 
     rb_str_modify(str);
-    s = t = RSTRING_PTR(str);
-    if (!s || RSTRING_LEN(str) == 0) return Qnil;
+    s = t = RSTRING_BYTEPTR(str);
+    if (!s || RSTRING_BYTELEN(str) == 0) return Qnil;
     send = RSTRING_END(str);
     save = -1;
     while (s < send) {
@@ -6021,8 +6021,8 @@
 	s += clen;
     }
     *t = '\0';
-    if (t - RSTRING_PTR(str) != RSTRING_LEN(str)) {
-	STR_SET_LEN(str, t - RSTRING_PTR(str));
+    if (t - RSTRING_BYTEPTR(str) != RSTRING_BYTELEN(str)) {
+	STR_SET_LEN(str, t - RSTRING_BYTEPTR(str));
 	modify = 1;
     }
 
@@ -6147,8 +6147,8 @@
 	tr_setup_table(s, table,i==0, &del, &nodel, enc);
     }
 
-    s = RSTRING_PTR(str);
-    if (!s || RSTRING_LEN(str) == 0) return INT2FIX(0);
+    s = RSTRING_BYTEPTR(str);
+    if (!s || RSTRING_BYTELEN(str) == 0) return INT2FIX(0);
     send = RSTRING_END(str);
     i = 0;
     while (s < send) {
@@ -6221,9 +6221,9 @@
     long clen;
 
 #if !WITH_OBJC
-    cstr = RSTRING_CPTR(str);
+    cstr = RSTRING_PTR(str);
 #endif
-    clen = RSTRING_CLEN(str);
+    clen = RSTRING_LEN(str);
 
     if (rb_scan_args(argc, argv, "02", &spat, &limit) == 2) {
 	lim = NUM2INT(limit);
@@ -6250,7 +6250,7 @@
 	if (TYPE(spat) == T_STRING) {
 #if WITH_OBJC
 	    spat_string = Qtrue;
-	    if (RSTRING_CLEN(spat) == 1
+	    if (RSTRING_LEN(spat) == 1
 		&& CFStringGetCharacterAtIndex((CFStringRef)spat, 0) == ' ') {
 		awk_split = Qtrue;
 	    }
@@ -6259,8 +6259,8 @@
 	    long spat_clen;
 	    rb_encoding *enc2 = STR_ENC_GET(spat);
 
-	    spat_cstr = RSTRING_CPTR(spat);
-	    spat_clen = RSTRING_CLEN(spat);
+	    spat_cstr = RSTRING_PTR(spat);
+	    spat_clen = RSTRING_LEN(spat);
 	    if (rb_enc_mbminlen(enc2) == 1) {
 		if (spat_clen == 1 && spat_cstr[0] == ' '){
 		    awk_split = Qtrue;
@@ -6443,7 +6443,7 @@
     }
     if (NIL_P(limit) && lim == 0) {
 	while (RARRAY_LEN(result) > 0 &&
-	       RSTRING_CLEN(RARRAY_AT(result, RARRAY_LEN(result)-1)) == 0)
+	       RSTRING_LEN(RARRAY_AT(result, RARRAY_LEN(result)-1)) == 0)
 	    rb_ary_pop(result);
     }
 
@@ -6602,9 +6602,9 @@
 	return str;
     }
     str = rb_str_new4(str);
-    ptr = p = s = RSTRING_PTR(str);
-    pend = p + RSTRING_LEN(str);
-    len = RSTRING_LEN(str);
+    ptr = p = s = RSTRING_BYTEPTR(str);
+    pend = p + RSTRING_BYTELEN(str);
+    len = RSTRING_BYTELEN(str);
     StringValue(rs);
     if (rs == rb_default_rs) {
 	enc = rb_enc_get(str);
@@ -6630,12 +6630,12 @@
     }
 
     enc = rb_enc_check(str, rs);
-    rslen = RSTRING_LEN(rs);
+    rslen = RSTRING_BYTELEN(rs);
     if (rslen == 0) {
 	newline = '\n';
     }
     else {
-	newline = rb_enc_codepoint(RSTRING_PTR(rs), RSTRING_END(rs), enc);
+	newline = rb_enc_codepoint(RSTRING_BYTEPTR(rs), RSTRING_END(rs), enc);
     }
 
     while (p < pend) {
@@ -6649,7 +6649,7 @@
 	    p -= n;
 	}
 	if (c == newline &&
-	    (rslen <= 1 || memcmp(RSTRING_PTR(rs), p, rslen) == 0)) {
+	    (rslen <= 1 || memcmp(RSTRING_BYTEPTR(rs), p, rslen) == 0)) {
 	    line = rb_str_new5(str, s, p - s + (rslen ? rslen : n));
 	    OBJ_INFECT(line, str);
 	    rb_enc_cr_str_copy_for_substr(line, str);
@@ -6707,8 +6707,8 @@
 
     RETURN_ENUMERATOR(str, 0, 0);
 
-    n = RSTRING_LEN(str);
-    ptr = RSTRING_PTR(str);
+    n = RSTRING_BYTELEN(str);
+    ptr = RSTRING_BYTEPTR(str);
     for (i=0; i<n; i++) {
 	rb_yield(INT2FIX(ptr[i] & 0xff));
     }
@@ -6769,8 +6769,8 @@
 
     RETURN_ENUMERATOR(str, 0, 0);
     str = rb_str_new4(str);
-    ptr = RSTRING_PTR(str);
-    len = RSTRING_LEN(str);
+    ptr = RSTRING_BYTEPTR(str);
+    len = RSTRING_BYTELEN(str);
     enc = rb_enc_get(str);
     for (i = 0; i < len; i += n) {
 	n = rb_enc_mbclen(ptr + i, ptr + len, enc);
@@ -6787,8 +6787,8 @@
     rb_encoding *enc = STR_ENC_GET(str);
     const char *p, *p2, *beg, *end;
 
-    beg = RSTRING_PTR(str);
-    end = beg + RSTRING_LEN(str);
+    beg = RSTRING_BYTEPTR(str);
+    end = beg + RSTRING_BYTELEN(str);
     if (beg > end) return 0;
     p = rb_enc_prev_char(beg, end, enc);
     if (!p) return 0;
@@ -6821,7 +6821,7 @@
     if (n == 0)
 	return Qnil;
     rb_str_modify(str);
-    p = RSTRING_CPTR(str);
+    p = RSTRING_PTR(str);
     r = CFRangeMake(n - 1, 1);
     if (n >= 2 && p[n - 1] == '\n' && p[n - 2] == '\r') {
 	/* We need this to pass the tests, but this is most probably 
@@ -6833,12 +6833,12 @@
     CFStringDelete((CFMutableStringRef)str, r);
     return str;
 #else
-    if (RSTRING_LEN(str) > 0) {
+    if (RSTRING_BYTELEN(str) > 0) {
 	long len;
 	rb_str_modify(str);
 	len = chopped_length(str);
 	STR_SET_LEN(str, len);
-	RSTRING_PTR(str)[len] = '\0';
+	RSTRING_BYTEPTR(str)[len] = '\0';
 	return str;
     }
     return Qnil;
@@ -6871,7 +6871,7 @@
     rb_str_chop_bang(str2);
     return str2;
 #else
-    VALUE str2 = rb_str_new5(str, RSTRING_PTR(str), chopped_length(str));
+    VALUE str2 = rb_str_new5(str, RSTRING_BYTEPTR(str), chopped_length(str));
     rb_enc_cr_str_copy_for_substr(str2, str);
     OBJ_INFECT(str2, str);
     return str2;
@@ -6941,9 +6941,9 @@
     char *p, *pp, *e;
     long len, rslen;
 
-	len = RSTRING_LEN(str);
+	len = RSTRING_BYTELEN(str);
 	if (len == 0) return Qnil;
-	p = RSTRING_PTR(str);
+	p = RSTRING_BYTEPTR(str);
     e = p + len;
     if (argc == 0) {
 	rs = rb_rs;
@@ -6966,47 +6966,47 @@
 		if (e == RSTRING_END(str)) {
 		    return Qnil;
 		}
-		len = e - RSTRING_PTR(str);
+		len = e - RSTRING_BYTEPTR(str);
 		STR_SET_LEN(str, len);
 	    }
 	    else {
-	    if (RSTRING_PTR(str)[len-1] == '\n') {
+	    if (RSTRING_BYTEPTR(str)[len-1] == '\n') {
 		STR_DEC_LEN(str);
-		if (RSTRING_LEN(str) > 0 &&
-		    RSTRING_PTR(str)[RSTRING_LEN(str)-1] == '\r') {
+		if (RSTRING_BYTELEN(str) > 0 &&
+		    RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)-1] == '\r') {
 		    STR_DEC_LEN(str);
 		}
 	    }
-	    else if (RSTRING_PTR(str)[len-1] == '\r') {
+	    else if (RSTRING_BYTEPTR(str)[len-1] == '\r') {
 		STR_DEC_LEN(str);
 	    }
 	    else {
 		return Qnil;
 	    }
 	    }
-	    RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+	    RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)] = '\0';
 	    return str;
 	}
     }
     if (NIL_P(rs)) return Qnil;
     StringValue(rs);
-    rslen = RSTRING_LEN(rs);
+    rslen = RSTRING_BYTELEN(rs);
     if (rslen == 0) {
 	while (len>0 && p[len-1] == '\n') {
 	    len--;
 	    if (len>0 && p[len-1] == '\r')
 		len--;
 	}
-	if (len < RSTRING_LEN(str)) {
+	if (len < RSTRING_BYTELEN(str)) {
 	    rb_str_modify(str);
 	    STR_SET_LEN(str, len);
-	    RSTRING_PTR(str)[len] = '\0';
+	    RSTRING_BYTEPTR(str)[len] = '\0';
 	    return str;
 	}
 	return Qnil;
     }
     if (rslen > len) return Qnil;
-    newline = RSTRING_PTR(rs)[rslen-1];
+    newline = RSTRING_BYTEPTR(rs)[rslen-1];
     if (rslen == 1 && newline == '\n')
 	goto smart_chomp;
 
@@ -7017,12 +7017,12 @@
     pp = e - rslen;
     if (p[len-1] == newline &&
 	(rslen <= 1 ||
-	 memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
+	 memcmp(RSTRING_BYTEPTR(rs), pp, rslen) == 0)) {
 	if (rb_enc_left_char_head(p, pp, enc) != pp)
 	    return Qnil;
 	rb_str_modify(str);
-	STR_SET_LEN(str, RSTRING_LEN(str) - rslen);
-	RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+	STR_SET_LEN(str, RSTRING_BYTELEN(str) - rslen);
+	RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)] = '\0';
 	return str;
     }
     return Qnil;
@@ -7126,8 +7126,8 @@
 
     rb_str_modify(str);
     enc = STR_ENC_GET(str);
-    s = RSTRING_PTR(str);
-    if (!s || RSTRING_LEN(str) == 0) return Qnil;
+    s = RSTRING_BYTEPTR(str);
+    if (!s || RSTRING_BYTELEN(str) == 0) return Qnil;
     e = t = RSTRING_END(str);
     /* remove spaces at head */
     while (s < e) {
@@ -7137,11 +7137,11 @@
 	s += rb_enc_codelen(cc, enc);
     }
 
-    if (s > RSTRING_PTR(str)) {
+    if (s > RSTRING_BYTEPTR(str)) {
 	rb_str_modify(str);
 	STR_SET_LEN(str, t-s);
-	memmove(RSTRING_PTR(str), s, RSTRING_LEN(str));
-	RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+	memmove(RSTRING_BYTEPTR(str), s, RSTRING_BYTELEN(str));
+	RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)] = '\0';
 	return str;
     }
     return Qnil;
@@ -7193,8 +7193,8 @@
 
     rb_str_modify(str);
     enc = STR_ENC_GET(str);
-    s = RSTRING_PTR(str);
-    if (!s || RSTRING_LEN(str) == 0) return Qnil;
+    s = RSTRING_BYTEPTR(str);
+    if (!s || RSTRING_BYTELEN(str) == 0) return Qnil;
     t = e = RSTRING_END(str);
     while (s < e) {
 	int cc = rb_enc_codepoint(s, e, enc);
@@ -7211,8 +7211,8 @@
     if (!space_seen) t = s;
     if (t < e) {
 	rb_str_modify(str);
-	STR_SET_LEN(str, t-RSTRING_PTR(str));
-	RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+	STR_SET_LEN(str, t-RSTRING_BYTEPTR(str));
+	RSTRING_BYTEPTR(str)[RSTRING_BYTELEN(str)] = '\0';
 	return str;
     }
     return Qnil;
@@ -7327,8 +7327,8 @@
 	     * Always consume at least one character of the input string
 	     */
 #if !WITH_OBJC
-	    if (RSTRING_LEN(str) > END(0))
-		*start = END(0)+rb_enc_mbclen(RSTRING_PTR(str)+END(0),
+	    if (RSTRING_BYTELEN(str) > END(0))
+		*start = END(0)+rb_enc_mbclen(RSTRING_BYTEPTR(str)+END(0),
 					      RSTRING_END(str), enc);
 	    else
 #endif
@@ -7489,13 +7489,13 @@
     const char *s;
 
     StringValue(salt);
-    if (RSTRING_LEN(salt) < 2)
+    if (RSTRING_BYTELEN(salt) < 2)
 	rb_raise(rb_eArgError, "salt too short (need >=2 bytes)");
 
-    s = RSTRING_PTR(str);
+    s = RSTRING_BYTEPTR(str);
     if (s == NULL)
 	s = "";
-    result = rb_str_new2(crypt(s, RSTRING_PTR(salt)));
+    result = rb_str_new2(crypt(s, RSTRING_BYTEPTR(salt)));
     OBJ_INFECT(result, str);
     OBJ_INFECT(result, salt);
     return result;
@@ -7558,7 +7558,7 @@
 #else
     int c;
 
-    c = rb_enc_codepoint(RSTRING_PTR(s), RSTRING_END(s), STR_ENC_GET(s));
+    c = rb_enc_codepoint(RSTRING_BYTEPTR(s), RSTRING_END(s), STR_ENC_GET(s));
     return INT2NUM(c);
 #endif
 }
@@ -7589,8 +7589,8 @@
 	rb_scan_args(argc, argv, "01", &vbits);
 	bits = NUM2INT(vbits);
     }
-    ptr = p = RSTRING_PTR(str);
-    len = RSTRING_LEN(str);
+    ptr = p = RSTRING_BYTEPTR(str);
+    len = RSTRING_BYTELEN(str);
     pend = p + len;
     if (bits >= sizeof(long)*CHAR_BIT) {
 	VALUE sum = INT2FIX(0);
@@ -7699,8 +7699,8 @@
     if (argc == 2) {
 	StringValue(pad);
 	enc = rb_enc_check(str, pad);
-	f = RSTRING_PTR(pad);
-	flen = RSTRING_LEN(pad);
+	f = RSTRING_BYTEPTR(pad);
+	flen = RSTRING_BYTELEN(pad);
 	fclen = str_strlen(pad, enc);
 	singlebyte = single_byte_optimizable(pad);
 	if (flen == 0 || fclen == 0) {
@@ -7712,8 +7712,8 @@
     n = width - len;
     llen = (jflag == 'l') ? 0 : ((jflag == 'r') ? n : n/2);
     rlen = n - llen;
-    res = rb_str_new5(str, 0, RSTRING_LEN(str)+n*flen/fclen+2);
-    p = RSTRING_PTR(res);
+    res = rb_str_new5(str, 0, RSTRING_BYTELEN(str)+n*flen/fclen+2);
+    p = RSTRING_BYTEPTR(res);
     while (llen) {
 	if (flen <= 1) {
 	    *p++ = *f;
@@ -7732,8 +7732,8 @@
 	    break;
 	}
     }
-    memcpy(p, RSTRING_PTR(str), RSTRING_LEN(str));
-    p+=RSTRING_LEN(str);
+    memcpy(p, RSTRING_BYTEPTR(str), RSTRING_BYTELEN(str));
+    p+=RSTRING_BYTELEN(str);
     while (rlen) {
 	if (flen <= 1) {
 	    *p++ = *f;
@@ -7753,7 +7753,7 @@
 	}
     }
     *p = '\0';
-    STR_SET_LEN(res, p-RSTRING_PTR(res));
+    STR_SET_LEN(res, p-RSTRING_BYTEPTR(res));
     OBJ_INFECT(res, str);
     if (!NIL_P(pad)) OBJ_INFECT(res, pad);
     rb_enc_associate(res, enc);
@@ -7887,7 +7887,7 @@
 static VALUE
 rb_str_rpartition(VALUE str, VALUE sep)
 {
-    long pos = RSTRING_LEN(str);
+    long pos = RSTRING_BYTELEN(str);
     int regex = Qfalse;
     long seplen;
 
@@ -7914,7 +7914,7 @@
 	if (sep == Qnil)
 	    return rb_ary_new3(3, rb_str_new(0,0),rb_str_new(0,0), str);
     }
-    seplen = RSTRING_CLEN(sep);
+    seplen = RSTRING_LEN(sep);
     return rb_ary_new3(3, rb_str_substr(str, 0, pos),
 		          sep,
 		          rb_str_substr(str, pos + seplen, seplen));
@@ -7940,8 +7940,8 @@
 	    return Qtrue;
 #else
 	rb_enc_check(str, tmp);
-	if (RSTRING_LEN(str) < RSTRING_LEN(tmp)) continue;
-	if (memcmp(RSTRING_PTR(str), RSTRING_PTR(tmp), RSTRING_LEN(tmp)) == 0)
+	if (RSTRING_BYTELEN(str) < RSTRING_BYTELEN(tmp)) continue;
+	if (memcmp(RSTRING_BYTEPTR(str), RSTRING_BYTEPTR(tmp), RSTRING_BYTELEN(tmp)) == 0)
 	    return Qtrue;
 #endif
     }
@@ -7972,12 +7972,12 @@
 	    return Qtrue;
 #else
 	enc = rb_enc_check(str, tmp);
-	if (RSTRING_LEN(str) < RSTRING_LEN(tmp)) continue;
-	p = RSTRING_PTR(str);
-	s = p + RSTRING_LEN(str) - RSTRING_LEN(tmp);
+	if (RSTRING_BYTELEN(str) < RSTRING_BYTELEN(tmp)) continue;
+	p = RSTRING_BYTEPTR(str);
+	s = p + RSTRING_BYTELEN(str) - RSTRING_BYTELEN(tmp);
 	if (rb_enc_left_char_head(p, s, enc) != s)
 	    continue;
-	if (memcmp(s, RSTRING_PTR(tmp), RSTRING_LEN(tmp)) == 0)
+	if (memcmp(s, RSTRING_BYTEPTR(tmp), RSTRING_BYTELEN(tmp)) == 0)
 	    return Qtrue;
 #endif
     }
@@ -8084,14 +8084,14 @@
     rb_str_modify(str);
     StringValue(transform_name);
     
-    range = CFRangeMake(0, RSTRING_CLEN(str));
+    range = CFRangeMake(0, RSTRING_LEN(str));
 
     if (!CFStringTransform((CFMutableStringRef)str, 
 	&range,
 	(CFStringRef)transform_name,
        	false))
 	rb_raise(rb_eRuntimeError, "cannot apply transformation `%s' to `%s'",
-		RSTRING_CPTR(transform_name), RSTRING_CPTR(str));
+		RSTRING_PTR(transform_name), RSTRING_PTR(str));
 
     return range.length == kCFNotFound ? Qnil : str;
 }
@@ -8174,7 +8174,7 @@
     VALUE str;
 
     sym = rb_id2str(id);
-    if (!rb_enc_symname_p(RSTRING_CPTR(sym), NULL)) {
+    if (!rb_enc_symname_p(RSTRING_PTR(sym), NULL)) {
 	sym = rb_str_inspect(sym);
     }
     str = rb_str_new(":", 1);
@@ -8187,13 +8187,13 @@
 
     sym = rb_id2str(id);
     enc = STR_ENC_GET(sym);
-    str = rb_enc_str_new(0, RSTRING_LEN(sym)+1, enc);
-    RSTRING_PTR(str)[0] = ':';
-    memcpy(RSTRING_PTR(str)+1, RSTRING_PTR(sym), RSTRING_LEN(sym));
-    if (RSTRING_LEN(sym) != strlen(RSTRING_PTR(sym)) ||
-	!rb_enc_symname_p(RSTRING_PTR(sym), enc)) {	
+    str = rb_enc_str_new(0, RSTRING_BYTELEN(sym)+1, enc);
+    RSTRING_BYTEPTR(str)[0] = ':';
+    memcpy(RSTRING_BYTEPTR(str)+1, RSTRING_BYTEPTR(sym), RSTRING_BYTELEN(sym));
+    if (RSTRING_BYTELEN(sym) != strlen(RSTRING_BYTEPTR(sym)) ||
+	!rb_enc_symname_p(RSTRING_BYTEPTR(sym), enc)) {	
 	str = rb_str_inspect(str);
-	strncpy(RSTRING_PTR(str), ":\"", 2);
+	strncpy(RSTRING_BYTEPTR(str), ":\"", 2);
     }
     if (klass != Qundef) {
 	rb_str_cat2(str, "/");
@@ -8364,7 +8364,7 @@
 	tmp = rb_check_string_type(name);
 	if (NIL_P(tmp)) {
 	    rb_raise(rb_eTypeError, "%s is not a symbol",
-		     RSTRING_PTR(rb_inspect(name)));
+		     RSTRING_BYTEPTR(rb_inspect(name)));
 	}
 	name = tmp;
 	/* fall through */

Modified: MacRuby/trunk/thread.c
===================================================================
--- MacRuby/trunk/thread.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/thread.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -456,7 +456,7 @@
         if (!proc || !RTEST(loc = rb_proc_location(proc))) {
             rb_raise(rb_eThreadError, "already initialized thread");
         }
-	file = RSTRING_CPTR(RARRAY_AT(loc, 0));
+	file = RSTRING_PTR(RARRAY_AT(loc, 0));
 	if (NIL_P(line = RARRAY_AT(loc, 1))) {
 	    rb_raise(rb_eThreadError, "already initialized thread - %s",
 		     file);

Modified: MacRuby/trunk/time.c
===================================================================
--- MacRuby/trunk/time.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/time.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -425,14 +425,14 @@
 	if (!NIL_P(s)) {
 	    tm->tm_mon = -1;
 	    for (i=0; i<12; i++) {
-		if (RSTRING_CLEN(s) == 3 &&
-		    STRCASECMP(months[i], RSTRING_CPTR(s)) == 0) {
+		if (RSTRING_LEN(s) == 3 &&
+		    STRCASECMP(months[i], RSTRING_PTR(s)) == 0) {
 		    tm->tm_mon = i;
 		    break;
 		}
 	    }
 	    if (tm->tm_mon == -1) {
-		char c = RSTRING_CPTR(s)[0];
+		char c = RSTRING_PTR(s)[0];
 
 		if ('0' <= c && c <= '9') {
 		    tm->tm_mon = obj2long(s)-1;
@@ -2093,8 +2093,8 @@
 	rb_raise(rb_eArgError, "format should have ASCII compatible encoding");
     }
     format = rb_str_new4(format);
-    fmt = RSTRING_CPTR(format);
-    len = RSTRING_CLEN(format);
+    fmt = RSTRING_PTR(format);
+    len = RSTRING_LEN(format);
     if (len == 0) {
 	rb_warning("strftime called with empty format string");
     }
@@ -2117,7 +2117,7 @@
 	return str;
     }
     else {
-	len = rb_strftime(&buf, RSTRING_CPTR(format), &tobj->tm);
+	len = rb_strftime(&buf, RSTRING_PTR(format), &tobj->tm);
     }
     str = rb_str_new(buf, len);
     if (buf != buffer) xfree(buf);
@@ -2239,8 +2239,8 @@
     rb_copy_generic_ivar(time, str);
 
     StringValue(str);
-    buf = (unsigned char *)RSTRING_PTR(str); /* ok */
-    if (RSTRING_LEN(str) != 8) {
+    buf = (unsigned char *)RSTRING_BYTEPTR(str); /* ok */
+    if (RSTRING_BYTELEN(str) != 8) {
 	rb_raise(rb_eTypeError, "marshaled time format differ");
     }
 
@@ -2278,7 +2278,7 @@
             long len;
             int digit;
             ptr = (unsigned char*)StringValuePtr(submicro);
-            len = RSTRING_LEN(submicro);
+            len = RSTRING_BYTELEN(submicro);
             if (0 < len) {
                 if (10 <= (digit = ptr[0] >> 4)) goto end_submicro;
                 nsec += digit * 100;

Modified: MacRuby/trunk/transcode.c
===================================================================
--- MacRuby/trunk/transcode.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/transcode.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -241,7 +241,7 @@
 {
     VALUE dest_string = my_transcoding->ruby_string_dest;
     rb_str_resize(dest_string, new_len);
-    return (unsigned char *)RSTRING_PTR(dest_string);
+    return (unsigned char *)RSTRING_BYTEPTR(dest_string);
 }
 
 static int
@@ -321,26 +321,26 @@
 	my_transcoding.transcoder = my_transcoder;
 
 	if (my_transcoder->preprocessor) {
-	    fromp = sp = (unsigned char *)RSTRING_PTR(str);
-	    slen = RSTRING_LEN(str);
+	    fromp = sp = (unsigned char *)RSTRING_BYTEPTR(str);
+	    slen = RSTRING_BYTELEN(str);
 	    blen = slen + 30; /* len + margin */
 	    dest = rb_str_tmp_new(blen);
-	    bp = (unsigned char *)RSTRING_PTR(dest);
+	    bp = (unsigned char *)RSTRING_BYTEPTR(dest);
 	    my_transcoding.ruby_string_dest = dest;
 	    (*my_transcoder->preprocessor)(&fromp, &bp, (sp+slen), (bp+blen), &my_transcoding);
 	    if (fromp != sp+slen) {
 		rb_raise(rb_eArgError, "not fully converted, %td bytes left", sp+slen-fromp);
 	    }
-	    buf = (unsigned char *)RSTRING_PTR(dest);
+	    buf = (unsigned char *)RSTRING_BYTEPTR(dest);
 	    *bp = '\0';
 	    rb_str_set_len(dest, bp - buf);
 	    str = dest;
 	}
-	fromp = sp = (unsigned char *)RSTRING_PTR(str);
-	slen = RSTRING_LEN(str);
+	fromp = sp = (unsigned char *)RSTRING_BYTEPTR(str);
+	slen = RSTRING_BYTELEN(str);
 	blen = slen + 30; /* len + margin */
 	dest = rb_str_tmp_new(blen);
-	bp = (unsigned char *)RSTRING_PTR(dest);
+	bp = (unsigned char *)RSTRING_BYTEPTR(dest);
 	my_transcoding.ruby_string_dest = dest;
 	my_transcoding.flush_func = str_transcoding_resize;
 
@@ -348,22 +348,22 @@
 	if (fromp != sp+slen) {
 	    rb_raise(rb_eArgError, "not fully converted, %td bytes left", sp+slen-fromp);
 	}
-	buf = (unsigned char *)RSTRING_PTR(dest);
+	buf = (unsigned char *)RSTRING_BYTEPTR(dest);
 	*bp = '\0';
 	rb_str_set_len(dest, bp - buf);
 	if (my_transcoder->postprocessor) {
 	    str = dest;
-	    fromp = sp = (unsigned char *)RSTRING_PTR(str);
-	    slen = RSTRING_LEN(str);
+	    fromp = sp = (unsigned char *)RSTRING_BYTEPTR(str);
+	    slen = RSTRING_BYTELEN(str);
 	    blen = slen + 30; /* len + margin */
 	    dest = rb_str_tmp_new(blen);
-	    bp = (unsigned char *)RSTRING_PTR(dest);
+	    bp = (unsigned char *)RSTRING_BYTEPTR(dest);
 	    my_transcoding.ruby_string_dest = dest;
 	    (*my_transcoder->postprocessor)(&fromp, &bp, (sp+slen), (bp+blen), &my_transcoding);
 	    if (fromp != sp+slen) {
 		rb_raise(rb_eArgError, "not fully converted, %td bytes left", sp+slen-fromp);
 	    }
-	    buf = (unsigned char *)RSTRING_PTR(dest);
+	    buf = (unsigned char *)RSTRING_BYTEPTR(dest);
 	    *bp = '\0';
 	    rb_str_set_len(dest, bp - buf);
 	}
@@ -412,7 +412,7 @@
 
     /* transcoded string never be broken. */
     if (rb_enc_asciicompat(rb_enc_from_index(encidx))) {
-	rb_str_coderange_scan_restartable(RSTRING_PTR(str), RSTRING_END(str), 0, &cr);
+	rb_str_coderange_scan_restartable(RSTRING_BYTEPTR(str), RSTRING_END(str), 0, &cr);
     }
     else {
 	cr = ENC_CODERANGE_VALID;

Modified: MacRuby/trunk/util.c
===================================================================
--- MacRuby/trunk/util.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/util.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -279,18 +279,18 @@
     long slen;
     char buf[1024];
 
-    if (RSTRING_CLEN(str) > 1000)
+    if (RSTRING_LEN(str) > 1000)
         rb_fatal("Cannot do inplace edit on long filename (%ld characters)",
-		 RSTRING_CLEN(str));
+		 RSTRING_LEN(str));
 
 #if defined(DJGPP) || defined(__CYGWIN32__) || defined(_WIN32)
     /* Style 0 */
-    slen = RSTRING_CLEN(str);
+    slen = RSTRING_LEN(str);
     rb_str_cat(str, suffix, extlen);
 #if defined(DJGPP)
     if (_USE_LFN) return;
 #else
-    if (valid_filename(RSTRING_CPTR(str))) return;
+    if (valid_filename(RSTRING_PTR(str))) return;
 #endif
 
     /* Fooey, style 0 failed.  Fix str before continuing. */
@@ -298,7 +298,7 @@
 #endif
 
     slen = extlen;
-    t = buf; baselen = 0; s = RSTRING_CPTR(str);
+    t = buf; baselen = 0; s = RSTRING_PTR(str);
     while ((*t = *s) && *s != '.') {
 	baselen++;
 	if (*s == '\\' || *s == '/') baselen = 0;

Modified: MacRuby/trunk/variable.c
===================================================================
--- MacRuby/trunk/variable.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/variable.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -232,7 +232,7 @@
     OBJ_FREEZE(str);
     rb_ivar_set(klass, classpath, str);
 #if WITH_OBJC
-    rb_objc_rename_class(klass, RSTRING_CPTR(str));
+    rb_objc_rename_class(klass, RSTRING_PTR(str));
 #endif
 }
 
@@ -287,7 +287,7 @@
 const char *
 rb_class2name(VALUE klass)
 {
-    return RSTRING_CPTR(rb_class_name(klass));
+    return RSTRING_PTR(rb_class_name(klass));
 }
 
 const char *
@@ -1496,7 +1496,7 @@
 #endif
 	RDATA(av)->dfree != (RUBY_DATA_FUNC)st_free_table) {
 	VALUE desc = rb_inspect(av);
-	rb_raise(rb_eTypeError, "wrong autoload table: %s", RSTRING_CPTR(desc));
+	rb_raise(rb_eTypeError, "wrong autoload table: %s", RSTRING_PTR(desc));
     }
     return (struct st_table *)DATA_PTR(av);
 }
@@ -1587,10 +1587,10 @@
     }
     file = ((NODE *)load)->nd_lit;
     Check_Type(file, T_STRING);
-    if (RSTRING_CLEN(file) == 0) {
+    if (RSTRING_LEN(file) == 0) {
 	rb_raise(rb_eArgError, "empty file name");
     }
-    if (!rb_provided(RSTRING_CPTR(file))) {
+    if (!rb_provided(RSTRING_PTR(file))) {
 	return file;
     }
 

Modified: MacRuby/trunk/vm.c
===================================================================
--- MacRuby/trunk/vm.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/vm.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -619,9 +619,9 @@
 		rb_iseq_t *iseq = cfp->iseq;
 
 		line_no = vm_get_sourceline(cfp);
-		file = (char *)RSTRING_CPTR(iseq->filename);
+		file = (char *)RSTRING_PTR(iseq->filename);
 		str = rb_sprintf("%s:%d:in `%s'",
-				 file, line_no, RSTRING_CPTR(iseq->name));
+				 file, line_no, RSTRING_PTR(iseq->name));
 		rb_ary_push(ary, str);
 	    }
 	}
@@ -670,7 +670,7 @@
     rb_control_frame_t *cfp = vm_get_ruby_level_cfp(th, th->cfp);
 
     if (cfp) {
-	return RSTRING_CPTR(cfp->iseq->filename);
+	return RSTRING_PTR(cfp->iseq->filename);
     }
     else {
 	return 0;
@@ -1283,14 +1283,14 @@
 	if (cfp->pc != 0) {
 	    rb_iseq_t *iseq = cfp->iseq;
 	    int line_no = vm_get_sourceline(cfp);
-	    const char *file = RSTRING_CPTR(iseq->filename);
+	    const char *file = RSTRING_PTR(iseq->filename);
 	    str = rb_sprintf("%s:%d:in `%s'",
-			     file, line_no, RSTRING_CPTR(iseq->name));
+			     file, line_no, RSTRING_PTR(iseq->name));
 	}
     }
     else if (cfp->method_id) {
 	str = rb_sprintf("`%s#%s' (cfunc)",
-			 RSTRING_CPTR(rb_class_name(cfp->method_class)),
+			 RSTRING_PTR(rb_class_name(cfp->method_class)),
 			 rb_id2name(cfp->method_id));
     }
 

Modified: MacRuby/trunk/vm_dump.c
===================================================================
--- MacRuby/trunk/vm_dump.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/vm_dump.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -100,11 +100,11 @@
 	    int vm_get_sourceline(rb_control_frame_t *);
 
 	    pc = cfp->pc - cfp->iseq->iseq_encoded;
-	    iseq_name = RSTRING_CPTR(cfp->iseq->name);
+	    iseq_name = RSTRING_PTR(cfp->iseq->name);
 	    line = vm_get_sourceline(cfp);
 	    if (line) {
 		char fn[MAX_POSBUF+1];
-		snprintf(fn, MAX_POSBUF, "%s", RSTRING_CPTR(cfp->iseq->filename));
+		snprintf(fn, MAX_POSBUF, "%s", RSTRING_PTR(cfp->iseq->filename));
 		snprintf(posbuf, MAX_POSBUF, "%s:%d", fn, line);
 	    }
 	}
@@ -266,7 +266,7 @@
     else {
 	argc = iseq->argc;
 	local_size = iseq->local_size;
-	name = RSTRING_CPTR(iseq->name);
+	name = RSTRING_PTR(iseq->name);
     }
 
     /* stack trace header */

Modified: MacRuby/trunk/vm_eval.c
===================================================================
--- MacRuby/trunk/vm_eval.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/vm_eval.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -735,7 +735,7 @@
 
 	if (0) {		/* for debug */
 	    extern VALUE ruby_iseq_disasm(VALUE);
-	    printf("%s\n", RSTRING_CPTR(ruby_iseq_disasm(iseqval)));
+	    printf("%s\n", RSTRING_PTR(ruby_iseq_disasm(iseqval)));
 	}
 
 	/* save new env */
@@ -761,7 +761,7 @@
 		mesg = rb_attr_get(errinfo, rb_intern("mesg"));
 		if (!NIL_P(errat) && TYPE(errat) == T_ARRAY &&
 		    (bt2 = vm_backtrace(th, -2), RARRAY_LEN(bt2) > 0)) {
-		    if (!NIL_P(mesg) && TYPE(mesg) == T_STRING && !RSTRING_CLEN(mesg)) {
+		    if (!NIL_P(mesg) && TYPE(mesg) == T_STRING && !RSTRING_LEN(mesg)) {
 			rb_str_update(mesg, 0, 0, rb_str_new2(": "));
 			rb_str_update(mesg, 0, 0, RARRAY_AT(errat, 0));
 		    }
@@ -826,7 +826,7 @@
     }
 
     if (!NIL_P(vfile))
-	file = RSTRING_CPTR(vfile);
+	file = RSTRING_PTR(vfile);
     return eval_string(self, src, scope, file, line);
 }
 
@@ -1141,7 +1141,7 @@
     }
     if (!tt) {
 	VALUE desc = rb_inspect(tag);
-	rb_raise(rb_eArgError, "uncaught throw %s", RSTRING_CPTR(desc));
+	rb_raise(rb_eArgError, "uncaught throw %s", RSTRING_PTR(desc));
     }
     rb_trap_restore_mask();
     th->errinfo = NEW_THROW_OBJECT(tag, 0, TAG_THROW);
@@ -1316,7 +1316,7 @@
 
     ary = vm_backtrace(GET_THREAD(), -1);
     for (i = 0; i < RARRAY_LEN(ary); i++) {
-	printf("\tfrom %s\n", RSTRING_CPTR(RARRAY_AT(ary, i)));
+	printf("\tfrom %s\n", RSTRING_PTR(RARRAY_AT(ary, i)));
     }
 }
 

Modified: MacRuby/trunk/vm_insnhelper.c
===================================================================
--- MacRuby/trunk/vm_insnhelper.c	2008-07-09 22:21:52 UTC (rev 347)
+++ MacRuby/trunk/vm_insnhelper.c	2008-07-09 23:03:30 UTC (rev 348)
@@ -988,7 +988,7 @@
 	break;
       default:
 	rb_raise(rb_eTypeError, "%s is not a class/module",
-		 RSTRING_CPTR(rb_inspect(klass)));
+		 RSTRING_PTR(rb_inspect(klass)));
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080709/8398545c/attachment-0001.html 


More information about the macruby-changes mailing list