Skip to content

Commit

Permalink
use return_loaned_message_from (#523)
Browse files Browse the repository at this point in the history
Signed-off-by: Karsten Knese <karsten@openrobotics.org>
  • Loading branch information
Karsten1987 authored and mjcarroll committed Oct 22, 2019
1 parent cdf1b4d commit 68c93c8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions rcl/include/rcl/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ rcl_publisher_get_default_options(void);
/// Borrow a loaned message.
/**
* The memory allocated for the ros message belongs to the middleware and must not be deallocated
* other than by a call to \sa rcl_return_loaned_message.
* other than by a call to \sa rcl_return_loaned_message_from_publisher.
*
* <hr>
* Attribute | Adherence
Expand Down Expand Up @@ -228,7 +228,7 @@ rcl_borrow_loaned_message(
const rosidl_message_type_support_t * type_support,
void ** ros_message);

/// Return a loaned message
/// Return a loaned message previously borrowed from a publisher.
/**
* The ownership of the passed in ros message will be transferred back to the middleware.
* The middleware might deallocate and destroy the message so that the pointer is no longer
Expand All @@ -252,7 +252,7 @@ rcl_borrow_loaned_message(
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_return_loaned_message(
rcl_return_loaned_message_from_publisher(
const rcl_publisher_t * publisher,
void * loaned_message);

Expand Down
6 changes: 3 additions & 3 deletions rcl/include/rcl/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ rcl_take_loaned_message(
rmw_message_info_t * message_info,
rmw_subscription_allocation_t * allocation);

/// Release a loaned message from a topic using a rcl subscription.
/// Return a loaned message from a topic using a rcl subscription.
/**
* If a loaned message was previously obtained from the middleware with a call to
* \sa rcl_take_loaned_message, this message has to be released to indicate to the middleware
* \sa rcl_take_loaned_message, this message has to be returned to indicate to the middleware
* that the user no longer needs that memory.
* The user must not delete the message.
*
Expand All @@ -375,7 +375,7 @@ rcl_take_loaned_message(
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_release_loaned_message(
rcl_return_loaned_message_from_subscription(
const rcl_subscription_t * subscription,
void * loaned_message);

Expand Down
4 changes: 2 additions & 2 deletions rcl/src/rcl/publisher.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,15 @@ rcl_borrow_loaned_message(
}

rcl_ret_t
rcl_return_loaned_message(
rcl_return_loaned_message_from_publisher(
const rcl_publisher_t * publisher,
void * loaned_message)
{
if (!rcl_publisher_is_valid(publisher)) {
return RCL_RET_PUBLISHER_INVALID; // error already set
}
RCL_CHECK_ARGUMENT_FOR_NULL(loaned_message, RCL_RET_INVALID_ARGUMENT);
return rmw_return_loaned_message(publisher->impl->rmw_handle, loaned_message);
return rmw_return_loaned_message_from_publisher(publisher->impl->rmw_handle, loaned_message);
}

rcl_ret_t
Expand Down
5 changes: 3 additions & 2 deletions rcl/src/rcl/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ rcl_take_loaned_message(
}

rcl_ret_t
rcl_release_loaned_message(
rcl_return_loaned_message_from_subscription(
const rcl_subscription_t * subscription,
void * loaned_message)
{
Expand All @@ -365,7 +365,8 @@ rcl_release_loaned_message(
return RCL_RET_SUBSCRIPTION_INVALID; // error already set
}
RCL_CHECK_ARGUMENT_FOR_NULL(loaned_message, RCL_RET_INVALID_ARGUMENT);
return rmw_release_loaned_message(subscription->impl->rmw_handle, loaned_message);
return rmw_return_loaned_message_from_subscription(
subscription->impl->rmw_handle, loaned_message);
}

const char *
Expand Down

0 comments on commit 68c93c8

Please sign in to comment.