refactor(uORB): out-line PublicationBase destructor to save flash

The ~PublicationBase() destructor was header-inline, so its null-check
plus the orb_get_queue_size()/unadvertise() branch was emitted at every
publication destruction site (PX4 links with bfd ld, no ICF, no LTO).

Move it into Publication.cpp alongside the already out-lined
advertise()/publish(), mirroring #27581.

Saves 2.4 kB of flash on px4_fmu-v6x_default.
This commit is contained in:
Balduin authored and Ramon Roche committed 2026-07-09 07:59:00 -07:00
1 parent 4791b70c15
commit 113bee1437
2 files changed
+11 -9

No files matched your search

+10
View File
@@ -45,6 +45,16 @@
namespace uORB
{
PublicationBase::~PublicationBase()
{
if (_handle != nullptr) {
// don't automatically unadvertise queued publications (eg vehicle_command)
if (Manager::orb_get_queue_size(_handle) == 1) {
unadvertise();
}
}
}
bool PublicationBase::advertise()
{
if (!advertised()) {
+1 -9
View File
@@ -64,15 +64,7 @@ protected:
PublicationBase(ORB_ID id) : _orb_id(id) {}
~PublicationBase()
{
if (_handle != nullptr) {
// don't automatically unadvertise queued publications (eg vehicle_command)
if (Manager::orb_get_queue_size(_handle) == 1) {
unadvertise();
}
}
}
~PublicationBase();
// type-independent publish; data points to a message of the topic's type
bool publish(const void *data);