mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Remove the pointless terminator from ConstantSpec slices.
This commit is contained in:
parent
0c54cd1634
commit
ba68203ebf
2 changed files with 10 additions and 16 deletions
|
@ -1073,7 +1073,7 @@ class PropertyDefiner:
|
|||
specTemplate is a template for each entry of the spec array
|
||||
|
||||
specTerminator is a terminator for the spec array (inserted at the end
|
||||
of the array)
|
||||
of the array), or None
|
||||
|
||||
specType is the actual typename of our spec
|
||||
|
||||
|
@ -1086,6 +1086,7 @@ class PropertyDefiner:
|
|||
|
||||
for member in array:
|
||||
specs.append(specTemplate % getDataTuple(member))
|
||||
if specTerminator:
|
||||
specs.append(specTerminator)
|
||||
|
||||
return (("static %s: [%s, ..%i] = [\n" +
|
||||
|
@ -1254,7 +1255,7 @@ class ConstDefiner(PropertyDefiner):
|
|||
return decls + self.generatePrefableArray(
|
||||
array, name,
|
||||
' ConstantSpec { name: &%s_name as *u8 as *libc::c_char, value: %s }',
|
||||
' ConstantSpec { name: 0 as *libc::c_char, value: VoidVal }',
|
||||
None,
|
||||
'ConstantSpec',
|
||||
specData)
|
||||
|
||||
|
|
|
@ -312,10 +312,8 @@ fn CreateInterfaceObject(cx: *mut JSContext, global: *mut JSObject, receiver: *m
|
|||
}
|
||||
|
||||
fn DefineConstants(cx: *mut JSContext, obj: *mut JSObject, constants: &'static [ConstantSpec]) -> bool {
|
||||
for spec in constants.iter() {
|
||||
if spec.name.is_null() {
|
||||
return true;
|
||||
}
|
||||
constants.iter().all(|spec| {
|
||||
assert!(spec.name.is_not_null());
|
||||
let jsval = match spec.value {
|
||||
NullVal => NullValue(),
|
||||
IntVal(i) => Int32Value(i),
|
||||
|
@ -325,16 +323,11 @@ fn DefineConstants(cx: *mut JSContext, obj: *mut JSObject, constants: &'static [
|
|||
VoidVal => UndefinedValue(),
|
||||
};
|
||||
unsafe {
|
||||
if JS_DefineProperty(cx, obj, spec.name,
|
||||
jsval, None,
|
||||
None,
|
||||
JS_DefineProperty(cx, obj, spec.name, jsval, None, None,
|
||||
JSPROP_ENUMERATE | JSPROP_READONLY |
|
||||
JSPROP_PERMANENT) == 0 {
|
||||
return false;
|
||||
JSPROP_PERMANENT) != 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fail!();
|
||||
})
|
||||
}
|
||||
|
||||
fn DefineMethods(cx: *mut JSContext, obj: *mut JSObject, methods: &'static [JSFunctionSpec]) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue