PropertyBag: Remove the lookup() stuff; we only use iteration now.

Yay!!!
parent 6254e293
......@@ -438,10 +438,6 @@ RsvgPropertyBag rsvg_property_bag_new (const char **atts);
G_GNUC_INTERNAL
void rsvg_property_bag_free (RsvgPropertyBag bag);
/* Implemented in rust/src/property_bag.rs */
G_GNUC_INTERNAL
const char *rsvg_property_bag_lookup (RsvgPropertyBag bag, const char *key);
typedef struct RsvgPropertyBagIter *RsvgPropertyBagIter;
/* Implemented in rust/src/property_bag.rs */
......
......@@ -133,7 +133,6 @@ pub use property_bag::{
rsvg_property_bag_iter_begin,
rsvg_property_bag_iter_end,
rsvg_property_bag_iter_next,
rsvg_property_bag_lookup,
rsvg_property_bag_new,
};
......
......@@ -79,15 +79,6 @@ impl<'a> PropertyBag<'a> {
self.0.len()
}
pub fn lookup_cstr(&self, key: &CStr) -> Option<(Attribute, &CStr)> {
self.0.get(key).map(|&(a, v)| (a, v))
}
pub fn lookup(&self, key: &str) -> Option<(Attribute, &str)> {
let k = CString::new(key).unwrap();
self.lookup_cstr(&k).map(|(a, v)| (a, v.to_str().unwrap()))
}
pub fn iter(&self) -> PropertyBagIter {
PropertyBagIter(self.cstr_iter())
}
......@@ -126,19 +117,6 @@ pub extern fn rsvg_property_bag_free(pbag: *mut PropertyBag) {
}
}
#[no_mangle]
pub extern fn rsvg_property_bag_lookup(pbag: *const PropertyBag,
raw_key: *const libc::c_char) -> *const libc::c_char {
unsafe {
let pbag = &*pbag;
let key = CStr::from_ptr(raw_key);
match pbag.lookup_cstr(key) {
Some((_, v)) => v.as_ptr(),
None => ptr::null()
}
}
}
#[no_mangle]
pub extern fn rsvg_property_bag_iter_begin(pbag: *const PropertyBag) -> *mut PropertyBagCStrIter {
assert!(!pbag.is_null());
......@@ -193,7 +171,7 @@ mod tests {
}
#[test]
fn property_bag_lookups_and_iters() {
fn property_bag_iters() {
let pairs = [
CString::new("rx").unwrap(),
CString::new("1").unwrap(),
......@@ -211,10 +189,6 @@ mod tests {
let pbag = unsafe { PropertyBag::new_from_key_value_pairs(v.as_ptr()) };
assert_eq!(pbag.lookup("rx"), Some((Attribute::Rx, "1")));
assert_eq!(pbag.lookup("ry"), Some((Attribute::Ry, "2")));
assert_eq!(pbag.lookup("stdDeviation"), None);
let mut had_rx: bool = false;
let mut had_ry: bool = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment