[Pdbg] [PATCH 6/9] main: Drop unused iterators with callbacks

Amitay Isaacs amitay at ozlabs.org
Tue Nov 20 15:19:50 AEDT 2018


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/main.c | 61 ------------------------------------------------------
 src/main.h |  8 -------
 2 files changed, 69 deletions(-)

diff --git a/src/main.c b/src/main.c
index 8c83a49..6693349 100644
--- a/src/main.c
+++ b/src/main.c
@@ -529,67 +529,6 @@ bool target_selected(struct pdbg_target *target)
 	return path_target_selected(target);
 }
 
-/* Returns the sum of return codes. This can be used to count how many targets the callback was run on. */
-int for_each_child_target(char *class, struct pdbg_target *parent,
-				 int (*cb)(struct pdbg_target *, uint32_t, uint64_t *, uint64_t *),
-				 uint64_t *arg1, uint64_t *arg2)
-{
-	int rc = 0;
-	struct pdbg_target *target;
-	uint32_t index;
-	enum pdbg_target_status status;
-
-	pdbg_for_each_target(class, parent, target) {
-		if (!target_selected(target))
-			continue;
-
-		index = pdbg_target_index(target);
-		assert(index != -1);
-		status = pdbg_target_status(target);
-		if (status != PDBG_TARGET_ENABLED)
-			continue;
-
-		rc += cb(target, index, arg1, arg2);
-	}
-
-	return rc;
-}
-
-int for_each_target(char *class, int (*cb)(struct pdbg_target *, uint32_t, uint64_t *, uint64_t *), uint64_t *arg1, uint64_t *arg2)
-{
-	struct pdbg_target *target;
-	uint32_t index;
-	enum pdbg_target_status status;
-	int rc = 0;
-
-	pdbg_for_each_class_target(class, target) {
-		if (!target_selected(target))
-			continue;
-
-		index = pdbg_target_index(target);
-		assert(index != -1);
-		status = pdbg_target_status(target);
-		if (status != PDBG_TARGET_ENABLED)
-			continue;
-
-		rc += cb(target, index, arg1, arg2);
-	}
-
-	return rc;
-}
-
-void for_each_target_release(char *class)
-{
-	struct pdbg_target *target;
-
-	pdbg_for_each_class_target(class, target) {
-		if (!target_selected(target))
-			continue;
-
-		pdbg_target_release(target);
-	}
-}
-
 static bool target_selection(void)
 {
 	switch (backend) {
diff --git a/src/main.h b/src/main.h
index b1366d9..a97826c 100644
--- a/src/main.h
+++ b/src/main.h
@@ -30,11 +30,3 @@ static inline bool target_is_disabled(struct pdbg_target *target)
 void target_select(struct pdbg_target *target);
 void target_unselect(struct pdbg_target *target);
 bool target_selected(struct pdbg_target *target);
-
-/* Returns the sum of return codes. This can be used to count how many targets the callback was run on. */
-int for_each_child_target(char *class, struct pdbg_target *parent,
-				 int (*cb)(struct pdbg_target *, uint32_t, uint64_t *, uint64_t *),
-				 uint64_t *arg1, uint64_t *arg2);
-
-int for_each_target(char *class, int (*cb)(struct pdbg_target *, uint32_t, uint64_t *, uint64_t *), uint64_t *arg1, uint64_t *arg2);
-void for_each_target_release(char *class);
-- 
2.19.1



More information about the Pdbg mailing list