[librsvg: 92/95] PropertyBag: Remove the lookup() stuff; we only use iteration now.
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 92/95] PropertyBag: Remove the lookup() stuff; we only use iteration now.
- Date: Thu, 22 Feb 2018 03:20:52 +0000 (UTC)
commit 68ed408ce91e53a5e7d114915280e7ab26e4c181
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Feb 21 18:19:26 2018 -0600
PropertyBag: Remove the lookup() stuff; we only use iteration now.
Yay!!!
rsvg-private.h | 4 ----
rust/src/lib.rs | 1 -
rust/src/property_bag.rs | 28 +---------------------------
3 files changed, 1 insertion(+), 32 deletions(-)
---
diff --git a/rsvg-private.h b/rsvg-private.h
index 29217857..3e557b37 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -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 */
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 4860a0d3..30e4ed52 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.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,
};
diff --git a/rust/src/property_bag.rs b/rust/src/property_bag.rs
index 7fd0b43c..ac558758 100644
--- a/rust/src/property_bag.rs
+++ b/rust/src/property_bag.rs
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]