Reset RMWCount when DEALLOC rmw storage of wait set (fix build issue) (#211)

It is safe to reset RMWCount when free RMWStorage

Signed-off-by: jwang <jing.j.wang@intel.com>
This commit is contained in:
jwang11 2018-01-24 01:36:45 +08:00 committed by Dirk Thomas
parent 77321c62eb
commit 90f478eb1a

View file

@ -315,11 +315,12 @@ rcl_wait_set_get_allocator(const rcl_wait_set_t * wait_set, rcl_allocator_t * al
} \ } \
return RCL_RET_OK; return RCL_RET_OK;
#define SET_RESIZE_RMW_DEALLOC(RMWStorage) \ #define SET_RESIZE_RMW_DEALLOC(RMWStorage, RMWCount) \
/* Also deallocate the rmw storage. */ \ /* Also deallocate the rmw storage. */ \
if (wait_set->impl->RMWStorage) { \ if (wait_set->impl->RMWStorage) { \
allocator.deallocate((void *)wait_set->impl->RMWStorage, allocator.state); \ allocator.deallocate((void *)wait_set->impl->RMWStorage, allocator.state); \
wait_set->impl->RMWStorage = NULL; \ wait_set->impl->RMWStorage = NULL; \
wait_set->impl->RMWCount = 0; \
} }
#define SET_RESIZE_RMW_REALLOC(Type, RMWStorage, RMWCount) \ #define SET_RESIZE_RMW_REALLOC(Type, RMWStorage, RMWCount) \
@ -377,7 +378,7 @@ rcl_wait_set_resize_subscriptions(rcl_wait_set_t * wait_set, size_t size)
SET_RESIZE( SET_RESIZE(
subscription, subscription,
SET_RESIZE_RMW_DEALLOC( SET_RESIZE_RMW_DEALLOC(
rmw_subscriptions.subscribers), rmw_subscriptions.subscribers, rmw_subscriptions.subscriber_count),
SET_RESIZE_RMW_REALLOC( SET_RESIZE_RMW_REALLOC(
subscription, rmw_subscriptions.subscribers, rmw_subscriptions.subscriber_count) subscription, rmw_subscriptions.subscribers, rmw_subscriptions.subscriber_count)
) )
@ -411,7 +412,8 @@ rcl_wait_set_resize_guard_conditions(rcl_wait_set_t * wait_set, size_t size)
SET_RESIZE( SET_RESIZE(
guard_condition, guard_condition,
SET_RESIZE_RMW_DEALLOC( SET_RESIZE_RMW_DEALLOC(
rmw_guard_conditions.guard_conditions), rmw_guard_conditions.guard_conditions,
rmw_guard_conditions.guard_condition_count),
SET_RESIZE_RMW_REALLOC( SET_RESIZE_RMW_REALLOC(
guard_condition, guard_condition,
rmw_guard_conditions.guard_conditions, rmw_guard_conditions.guard_conditions,
@ -467,7 +469,7 @@ rcl_wait_set_resize_clients(rcl_wait_set_t * wait_set, size_t size)
{ {
SET_RESIZE(client, SET_RESIZE(client,
SET_RESIZE_RMW_DEALLOC( SET_RESIZE_RMW_DEALLOC(
rmw_clients.clients), rmw_clients.clients, rmw_clients.client_count),
SET_RESIZE_RMW_REALLOC( SET_RESIZE_RMW_REALLOC(
client, rmw_clients.clients, rmw_clients.client_count) client, rmw_clients.clients, rmw_clients.client_count)
) )
@ -499,7 +501,7 @@ rcl_wait_set_resize_services(rcl_wait_set_t * wait_set, size_t size)
{ {
SET_RESIZE(service, SET_RESIZE(service,
SET_RESIZE_RMW_DEALLOC( SET_RESIZE_RMW_DEALLOC(
rmw_services.services), rmw_services.services, rmw_services.service_count),
SET_RESIZE_RMW_REALLOC( SET_RESIZE_RMW_REALLOC(
service, rmw_services.services, rmw_services.service_count) service, rmw_services.services, rmw_services.service_count)
) )