summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/psource.h
diff options
context:
space:
mode:
author couriersud <couriersud@users.noreply.github.com>2022-06-20 20:01:03 +0200
committer GitHub <noreply@github.com>2022-06-20 20:01:03 +0200
commit0dad442511fc3e96bae721c38fe8040a222cc21a (patch)
treeb0eb0732f9e7f438a41a889621d36193d16d6e1b /src/lib/netlist/plib/psource.h
parent3fbfe0b1d76573ee8971eaaee6b37b4024575624 (diff)
netlist: fix bug, prepare for future changes and improve readability (#9947)
* netlist: fix bug, prepare for future changes and improve readability - fix a bug where a net processing error may trigger a nullptr access - applied some clang-tidy recommendations - add no_return to plib::terminate - properly encapsulate dynamic_cast usage - more review of noexcept - added a clang-format file. Over time, all source files will be processed with clang-format - Used clang format on a number of files - Rewrote 74174 - all device constructors now use a struct to pass data on to base classes. Neither netlist state nor the name are intended to be used in a constructor. After the base class was constructed, they can be accessed by state() and name(). - The device construction macros can now be removed. Changes to the core will not need to be reflected in constructors. - Change truth table macros so that going forward NETLIST_END and TRUTH_TABLE_END can be replaced by a closing curly brace. netlists can than use curly braces enclosed blocks. - more clang-format - removed some macros completely - all derived classes from base_device_t now don't use macros any longer. - as a result, delegator_t was removed. This class was only used to support macros :-(
Diffstat (limited to 'src/lib/netlist/plib/psource.h')
-rw-r--r--src/lib/netlist/plib/psource.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/netlist/plib/psource.h b/src/lib/netlist/plib/psource.h
index a26480aaad9..80a313ec415 100644
--- a/src/lib/netlist/plib/psource.h
+++ b/src/lib/netlist/plib/psource.h
@@ -140,10 +140,9 @@ namespace plib
{
for (auto &s : m_collection)
{
- auto *source(dynamic_cast<S *>(s.get()));
- if (source)
+ if (auto source = plib::dynamic_downcast<S *>(s.get()))
{
- auto strm = source->stream(name);
+ auto strm = (*source)->stream(name);
if (!strm.empty())
return strm;
}
@@ -156,10 +155,9 @@ namespace plib
{
for (auto &s : m_collection)
{
- auto *source(dynamic_cast<S *>(s.get()));
- if (source)
+ if (auto source = plib::dynamic_downcast<S *>(s.get()))
{
- if (lambda(source))
+ if (lambda(*source))
return true;
}
}