For loops and misc changes

This commit is contained in:
Keegan McAllister 2013-08-09 15:46:10 -07:00
parent 1bdaff0fad
commit 307f1074d3
42 changed files with 220 additions and 243 deletions

View file

@ -76,10 +76,10 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
}
let result = ~"[object " + name + "]";
for result.iter().enumerate().advance |(i, c)| {
*chars.offset(i) = c as jschar;
for (i, c) in result.iter().enumerate() {
*chars.offset(i as int) = c as jschar;
}
*chars.offset(nchars) = 0;
*chars.offset(nchars as int) = 0;
let jsstr = JS_NewUCString(cx, cast::transmute(chars), nchars as u64);
if jsstr.is_null() {
JS_free(cx, cast::transmute(chars));