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/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 4ebdefb..b731df0 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.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,
@@ -115,7 +115,10 @@
{
BOOST_ASSERT(entry != nullptr);
- entry->deleteInRecord(face);
+ auto in = entry->getInRecord(face);
+ if (in != entry->in_end()) {
+ entry->deleteInRecord(in);
+ }
entry->deleteOutRecord(face);
/// \todo decide whether to delete PIT entry if there's no more in/out-record left