servo: Merge #2637 - Remove unused InitIds function (from Ms2ger:initids); r=larsbergstrom
authorMs2ger <ms2ger@gmail.com>
Wed, 11 Jun 2014 13:35:08 -0400
changeset 334511 2acf0874f9ec860d41c877f72f189ff1a8a5fb64
parent 334510 d6ce1c202a88cda59148639396087a2092c2daef
child 334512 31ec9f20fa96096d4a29538def77a67fae9cd61c
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslarsbergstrom
servo: Merge #2637 - Remove unused InitIds function (from Ms2ger:initids); r=larsbergstrom Source-Repo: https://github.com/servo/servo Source-Revision: 6e2a9169580e6e0a77b5c7154230ded6116178ae
servo/src/components/script/dom/bindings/utils.rs
--- a/servo/src/components/script/dom/bindings/utils.rs
+++ b/servo/src/components/script/dom/bindings/utils.rs
@@ -17,23 +17,23 @@ use libc::c_uint;
 use std::mem;
 use std::cmp::Eq;
 use std::ptr;
 use std::ptr::null;
 use std::slice;
 use std::str;
 use js::glue::{js_IsObjectProxyClass, js_IsFunctionProxyClass, IsProxyHandlerFamily};
 use js::glue::{GetGlobalForObjectCrossCompartment, UnwrapObject, GetProxyHandlerExtra};
-use js::glue::{IsWrapper, RUST_JSID_TO_STRING, RUST_JSID_IS_INT, RUST_INTERNED_STRING_TO_JSID};
+use js::glue::{IsWrapper, RUST_JSID_TO_STRING, RUST_JSID_IS_INT};
 use js::glue::{RUST_JSID_IS_STRING, RUST_JSID_TO_INT};
 use js::jsapi::{JS_AlreadyHasOwnProperty, JS_NewFunction};
 use js::jsapi::{JS_DefineProperties, JS_ForwardGetPropertyTo};
 use js::jsapi::{JS_GetClass, JS_LinkConstructorAndPrototype, JS_GetStringCharsAndLength};
 use js::jsapi::{JS_ObjectIsRegExp, JS_ObjectIsDate, JSHandleObject};
-use js::jsapi::{JS_InternString, JS_GetFunctionObject};
+use js::jsapi::JS_GetFunctionObject;
 use js::jsapi::{JS_HasPropertyById, JS_GetPrototype};
 use js::jsapi::{JS_GetProperty, JS_HasProperty};
 use js::jsapi::{JS_DefineFunctions, JS_DefineProperty};
 use js::jsapi::{JS_ValueToString, JS_GetReservedSlot, JS_SetReservedSlot};
 use js::jsapi::{JSContext, JSObject, JSBool, jsid, JSClass, JSNative};
 use js::jsapi::{JSFunctionSpec, JSPropertySpec};
 use js::jsapi::{JS_NewGlobalObject, JS_InitStandardClasses};
 use js::jsapi::{JSString};
@@ -485,42 +485,16 @@ pub fn GetArrayIndexFromId(_cx: *mut JSC
         let i = 0;
         let str = AtomToLinearString(JSID_TO_ATOM(id));
         return if StringIsArray(str, &mut i) != 0 { i } else { -1 }
     } else {
         IdToInt32(cx, id);
     }*/
 }
 
-fn InternJSString(cx: *mut JSContext, chars: *libc::c_char) -> Option<jsid> {
-    unsafe {
-        let s = JS_InternString(cx, chars);
-        if s.is_not_null() {
-            Some(RUST_INTERNED_STRING_TO_JSID(cx, s))
-        } else {
-            None
-        }
-    }
-}
-
-pub fn InitIds(cx: *mut JSContext, specs: &[JSPropertySpec], ids: &mut [jsid]) -> bool {
-    for (i, spec) in specs.iter().enumerate() {
-        if spec.name.is_null() == true {
-            return true;
-        }
-        match InternJSString(cx, spec.name) {
-            Some(id) => ids[i] = id,
-            None => {
-                return false;
-            }
-        }
-    }
-    true
-}
-
 pub fn FindEnumStringIndex(cx: *mut JSContext,
                            v: JSVal,
                            values: &[&'static str]) -> Result<Option<uint>, ()> {
     unsafe {
         let jsstr = JS_ValueToString(cx, v);
         if jsstr.is_null() {
             return Err(());
         }