Skip to content

Commit

Permalink
Merge pull request servo#4 from tuncer/rust-changes
Browse files Browse the repository at this point in the history
Adapt to rust changes
  • Loading branch information
brson committed Aug 5, 2012
2 parents 7d72b51 + bbce458 commit ec7d242
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ extern fn debug(cx: *JSContext, argc: c_uint, vp: *jsval) -> JSBool {
#debug["%s", str];
}
JS_SET_RVAL(cx, vp, JSVAL_NULL);
ret 1_i32;
return 1_i32;
}
}

Expand Down
2 changes: 1 addition & 1 deletion name_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ impl methods of add for name_pool {
fn add(-s: ~str) -> *c_char {
let c_str = str::as_c_str(s, |bytes| bytes);
push(self.strbufs, s); // in theory, this should *move* the str in here..
ret c_str; // ...and so this ptr ought to be valid.
return c_str; // ...and so this ptr ought to be valid.
}
}
6 changes: 3 additions & 3 deletions rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl methods for cx {
fn new_compartment(globclsfn: fn(name_pool) -> JSClass) -> result<compartment,()> {
let np = name_pool();
let globcls = @globclsfn(np);
let globobj = JS_NewCompartmentAndGlobalObject(self.ptr, &*globcls as *JSClass, null());
let globobj = JS_NewCompartmentAndGlobalObject(self.ptr, ptr::assimilate(&*globcls), null());
result(JS_InitStandardClasses(self.ptr, globobj)).chain(|_ok| {
let compartment = @{cx: self,
name_pool: np,
Expand All @@ -96,7 +96,7 @@ impl methods for cx {
global_class: globcls,
global_obj: self.rooted_obj(globobj)
};
self.set_cx_private(&*compartment as *());
self.set_cx_private(ptr::assimilate(&*compartment) as *());
ok(compartment)
})
}
Expand Down Expand Up @@ -201,7 +201,7 @@ impl methods of methods for bare_compartment {
-> result<jsobj, ()> {
let classptr = @class_fn(self);
vec::push(self.cx.classes, classptr);
let obj = self.cx.rooted_obj(JS_NewObject(self.cx.ptr, &*classptr as *JSClass, proto, parent));
let obj = self.cx.rooted_obj(JS_NewObject(self.cx.ptr, ptr::assimilate(&*classptr), proto, parent));
result_obj(obj)
}
fn add_name(name: ~str) -> *c_char {
Expand Down

0 comments on commit ec7d242

Please sign in to comment.