From 8fae314b14d57b50f9eefd4b74198286caa37499 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Sun, 6 Aug 2006 21:09:10 +0000
Subject: [PATCH] Code cleanup. * src/server/aux-items.c
 (aux_item_check_unique): Removed bogus code that find_aux_item_definitions to
 be needlessly called. Force the caller to supply the definition, as all
 callers already do.

---
 ChangeLog              | 6 ++++++
 src/server/aux-items.c | 9 +++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e54f7112a..9d4b87561 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-08-01  Per Cederqvist  <ceder@lysator.liu.se>
 
+	Code cleanup.
+	* src/server/aux-items.c (aux_item_check_unique): Removed bogus
+	code that find_aux_item_definitions to be needlessly called.
+	Force the caller to supply the definition, as all callers already
+	do.
+
 	Removed code with no effect.  (Bug 142).
 	* src/server/aux-items.c (aux_item_link_items): Removed assignment
 	to a local variable that is not used after the assignment.
diff --git a/src/server/aux-items.c b/src/server/aux-items.c
index 82e4bb14b..d6029136f 100644
--- a/src/server/aux-items.c
+++ b/src/server/aux-items.c
@@ -192,7 +192,7 @@ static Aux_item_definition simple_aux_item =
 
 static Bool
 aux_item_check_unique(const Aux_item *item,
-                      const Aux_item_definition *xdef,
+                      const Aux_item_definition *def,
                       Aux_item_list *add_to_list,
                       unsigned long start_looking_at);
 
@@ -1157,6 +1157,8 @@ aux_item_check_unique(const Aux_item *item,
 {
     unsigned long i;
 
+    assert(def != NULL);
+
     if (add_to_list == NULL
 	|| item == NULL
 	|| start_looking_at >= add_to_list->length)
@@ -1164,11 +1166,6 @@ aux_item_check_unique(const Aux_item *item,
         return TRUE;
     }
 
-    if (def != NULL)
-	def = find_aux_item_definition(item);
-    if (def == NULL)
-        return TRUE;
-
     for (i = start_looking_at; i < add_to_list->length; i++)
     {
         if (def->one_per_person
-- 
GitLab