mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #26792 - servo:static-mut, r=nox
Replace `static mut` with `const`, `static`+`AtomicPtr`, or `static`+`UnsafeCell` Fixes https://github.com/servo/servo/issues/26550
This commit is contained in:
commit
00b57b4fd9
3 changed files with 93 additions and 77 deletions
|
@ -515,8 +515,8 @@ impl EventTarget {
|
|||
let name = CString::new(format!("on{}", &**ty)).unwrap();
|
||||
|
||||
// Step 3.9, subsection ParameterList
|
||||
static mut ARG_NAMES: [*const c_char; 1] = [b"event\0" as *const u8 as *const c_char];
|
||||
static mut ERROR_ARG_NAMES: [*const c_char; 5] = [
|
||||
const ARG_NAMES: &[*const c_char] = &[b"event\0" as *const u8 as *const c_char];
|
||||
const ERROR_ARG_NAMES: &[*const c_char] = &[
|
||||
b"event\0" as *const u8 as *const c_char,
|
||||
b"source\0" as *const u8 as *const c_char,
|
||||
b"lineno\0" as *const u8 as *const c_char,
|
||||
|
@ -524,13 +524,7 @@ impl EventTarget {
|
|||
b"error\0" as *const u8 as *const c_char,
|
||||
];
|
||||
let is_error = ty == &atom!("error") && self.is::<Window>();
|
||||
let args = unsafe {
|
||||
if is_error {
|
||||
&ERROR_ARG_NAMES[..]
|
||||
} else {
|
||||
&ARG_NAMES[..]
|
||||
}
|
||||
};
|
||||
let args = if is_error { ERROR_ARG_NAMES } else { ARG_NAMES };
|
||||
|
||||
let cx = window.get_cx();
|
||||
let options = unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue