[Crash-utility] [PATCH 2/6] do_list_no_hash: factor out all the debug statements at entry into do_list_debug_entry

Dave Wysochanski dwysocha at redhat.com
Tue Jul 10 22:24:35 UTC 2018


There's a number of statements at the entry to do_list_no_hash we can factor out.
This shortens the function and allows reuse.

Signed-off-by: Dave Wysochanski <dwysocha at redhat.com>
---
 tools.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/tools.c b/tools.c
index a642d60..2af114f 100644
--- a/tools.c
+++ b/tools.c
@@ -3862,19 +3862,9 @@ do_list(struct list_data *ld)
 	return count;
 }
 
-/*
- * Similar to do_list() but without the hash_table or LIST_ALLOCATE.
- * Useful for the 'list' command and other callers needing faster list
- * enumeration.
- */
-int
-do_list_no_hash(struct list_data *ld)
+static void do_list_debug_entry(struct list_data *ld)
 {
-	ulong next, last, first, offset;
-	ulong searchfor, readflag;
-	int i, count, others;
-	unsigned int radix;
-	struct req_entry **e = NULL;
+	int i, others;
 
 	if (CRASHDEBUG(1)) {
 		others = 0;
@@ -3922,6 +3912,23 @@ do_list_no_hash(struct list_data *ld)
 		console("     callback_data: %lx\n", (ulong)ld->callback_data);
 		console("struct_list_offset: %lx\n", ld->struct_list_offset);
 	}
+}
+
+/*
+ * Similar to do_list() but without the hash_table or LIST_ALLOCATE.
+ * Useful for the 'list' command and other callers needing faster list
+ * enumeration.
+ */
+int
+do_list_no_hash(struct list_data *ld)
+{
+	ulong next, last, first, offset;
+	ulong searchfor, readflag;
+	int i, count;
+	unsigned int radix;
+	struct req_entry **e = NULL;
+
+	do_list_debug_entry(ld);
 
 	count = 0;
 	searchfor = ld->searchfor;
-- 
1.8.3.1




More information about the Crash-utility mailing list