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
2026-07-08 09:07:11 +02:00
committed by Ramon Roche
parent 4791b70c15
commit 113bee1437
2 changed files with 11 additions and 9 deletions

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()) {

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);