[librsvg: 8/9] Remove Node::foreach_child()



commit 03cfc1fc12d93f27a777ce8515bdba1948636c03
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Thu Mar 15 22:44:13 2018 +0300

    Remove Node::foreach_child()

 librsvg/rsvg-private.h     | 11 -----------
 rsvg_internals/src/lib.rs  |  1 -
 rsvg_internals/src/node.rs | 35 -----------------------------------
 3 files changed, 47 deletions(-)
---
diff --git a/librsvg/rsvg-private.h b/librsvg/rsvg-private.h
index af6ac13f..4b2416be 100644
--- a/librsvg/rsvg-private.h
+++ b/librsvg/rsvg-private.h
@@ -428,17 +428,6 @@ gboolean rsvg_node_children_iter_next_back (RsvgNodeChildrenIter *iter,
 G_GNUC_INTERNAL
 void rsvg_node_children_iter_end (RsvgNodeChildrenIter *iter);
 
-/* Used to iterate among a node's children with rsvg_node_foreach_child().
- * If this caller-supplied function returns FALSE, iteration will stop.
- * Otherwise, iteration will continue to the next child node.
- *
- * Keep this in sync with rust/src/node.rs:NodeForeachChild
- */
-typedef gboolean (* RsvgNodeForeachChildFn) (RsvgNode *node, gpointer data);
-
-/* Implemented in rust/src/node.rs */
-G_GNUC_INTERNAL
-void rsvg_node_foreach_child (RsvgNode *node, RsvgNodeForeachChildFn fn, gpointer data);
 /* generic function for drawing all of the children of a particular node */
 
 /* Implemented in rust/src/node.rs */
diff --git a/rsvg_internals/src/lib.rs b/rsvg_internals/src/lib.rs
index bf09f27a..777bfd37 100644
--- a/rsvg_internals/src/lib.rs
+++ b/rsvg_internals/src/lib.rs
@@ -68,7 +68,6 @@ pub use node::{
     rsvg_node_children_iter_next_back,
     rsvg_node_draw,
     rsvg_node_draw_children,
-    rsvg_node_foreach_child,
     rsvg_node_get_parent,
     rsvg_node_get_state,
     rsvg_node_get_type,
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index fdde55f2..2063cee9 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -233,18 +233,6 @@ impl Node {
         }
     }
 
-    pub fn foreach_child<F>(&self, mut f: F)
-    where
-        F: FnMut(Rc<Node>) -> bool,
-    {
-        for child in self.children() {
-            let next = f(child);
-            if !next {
-                break;
-            }
-        }
-    }
-
     pub fn children(&self) -> Children {
         Children::new(self.children.borrow())
     }
@@ -470,29 +458,6 @@ pub extern "C" fn rsvg_node_set_attribute_parse_error(
     }
 }
 
-type NodeForeachChild =
-    unsafe extern "C" fn(node: *const RsvgNode, data: *const libc::c_void) -> glib_sys::gboolean;
-
-#[no_mangle]
-pub extern "C" fn rsvg_node_foreach_child(
-    raw_node: *const RsvgNode,
-    func: NodeForeachChild,
-    data: *const libc::c_void,
-) {
-    assert!(!raw_node.is_null());
-    let node: &RsvgNode = unsafe { &*raw_node };
-
-    node.foreach_child(|child| {
-        let boxed_child = box_node(child.clone());
-
-        let next: bool = unsafe { from_glib(func(boxed_child, data)) };
-
-        rsvg_node_unref(boxed_child);
-
-        next
-    });
-}
-
 // This should really return Children<'a> where 'a is the lifetime of raw_node,
 // but raw pointers don't have lifetimes so there's not much we can do.
 #[no_mangle]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]