table: optimize removal of PIT in-records

Most call sites already have an iterator that can be used directly,
so change deleteInRecord() to accept an iterator instead of doing
another list lookup.

Change-Id: Ie097f4bc4b13e7428e0580ed7cf4dcb506a009f7
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 32785b8..99f5d36 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -119,7 +119,10 @@
   sendNack(const lp::NackHeader& header, Face& egress, const shared_ptr<pit::Entry>& pitEntry) override
   {
     sendNackHistory.push_back({pitEntry->getInterest(), egress.getId(), header});
-    pitEntry->deleteInRecord(egress);
+    auto it = pitEntry->getInRecord(egress);
+    if (it != pitEntry->in_end()) {
+      pitEntry->deleteInRecord(it);
+    }
     afterAction();
     return true;
   }
diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp
index 45076e3..52b6f8b 100644
--- a/tests/daemon/table/pit-entry.t.cpp
+++ b/tests/daemon/table/pit-entry.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -139,7 +139,7 @@
   BOOST_CHECK_EQUAL(&in4->getFace(), face1.get());
 
   // delete in-record
-  entry.deleteInRecord(*face1);
+  entry.deleteInRecord(in4);
   BOOST_CHECK_EQUAL(entry.getInRecords().size(), 1);
   BOOST_CHECK(entry.getInRecord(*face1) == entry.in_end());