mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
remove unnecessary heap allocation (#30272)
This commit is contained in:
parent
e6558e35d2
commit
6eb3e16578
1 changed files with 2 additions and 2 deletions
|
@ -41,7 +41,7 @@ impl LocalCPrefValue {
|
||||||
match v {
|
match v {
|
||||||
PrefValue::Float(v) => LocalCPrefValue::Float(*v),
|
PrefValue::Float(v) => LocalCPrefValue::Float(*v),
|
||||||
PrefValue::Int(v) => LocalCPrefValue::Int(*v),
|
PrefValue::Int(v) => LocalCPrefValue::Int(*v),
|
||||||
PrefValue::Str(v) => LocalCPrefValue::Str(CString::new(v.clone()).unwrap()),
|
PrefValue::Str(v) => LocalCPrefValue::Str(CString::new(v.as_bytes()).unwrap()),
|
||||||
PrefValue::Bool(v) => LocalCPrefValue::Bool(*v),
|
PrefValue::Bool(v) => LocalCPrefValue::Bool(*v),
|
||||||
PrefValue::Missing => LocalCPrefValue::Missing,
|
PrefValue::Missing => LocalCPrefValue::Missing,
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ pub extern "C" fn get_prefs() -> CPrefList {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(key, (value, is_default))| {
|
.map(|(key, (value, is_default))| {
|
||||||
let l = Box::new(LocalCPref {
|
let l = Box::new(LocalCPref {
|
||||||
key: CString::new(key.clone()).unwrap(),
|
key: CString::new(key.as_bytes()).unwrap(),
|
||||||
value: LocalCPrefValue::new(&value),
|
value: LocalCPrefValue::new(&value),
|
||||||
is_default: is_default,
|
is_default: is_default,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue