mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 21:10:36 +08:00
refactor uorb: inline orb_publish_auto
It is a very small core function that needs to be fast.
This commit is contained in:
@@ -67,23 +67,6 @@ int orb_unadvertise(orb_advert_t handle)
|
||||
return uORB::Manager::get_instance()->orb_unadvertise(handle);
|
||||
}
|
||||
|
||||
int orb_publish_auto(const struct orb_metadata *meta, orb_advert_t *handle, const void *data, int *instance,
|
||||
int priority)
|
||||
{
|
||||
if (*handle == nullptr) {
|
||||
*handle = orb_advertise_multi(meta, data, instance, priority);
|
||||
|
||||
if (*handle != nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
return orb_publish(meta, *handle, data);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, const void *data)
|
||||
{
|
||||
return uORB::Manager::get_instance()->orb_publish(meta, handle, data);
|
||||
|
||||
Reference in New Issue
Block a user