Skip to content

Commit a067628

Browse files
Exit rmw_wait without session _run (#171) (#172)
* Modify char array to static * Exit rmw_wait if no items * Uncrustify (cherry picked from commit 945c000) Co-authored-by: Antonio Cuadros <49162117+Acuadros95@users.noreply.github.com>
1 parent 9b577d8 commit a067628

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

rmw_microxrcedds_c/src/rmw_client.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ rmw_create_client(
121121
custom_client->client_id,
122122
custom_node->participant_id, rmw_uxrce_entity_naming_buffer, UXR_REPLACE | UXR_REUSE);
123123
#else
124-
char req_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
125-
char res_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
124+
static char req_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
125+
static char res_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
126126
generate_service_types(
127127
custom_client->type_support_callbacks, req_type_name, res_type_name,
128128
RMW_UXRCE_TYPE_NAME_MAX_LENGTH);
129129

130-
char req_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
131-
char res_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
130+
static char req_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
131+
static char res_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
132132
generate_service_topics(
133133
service_name, req_topic_name, res_topic_name,
134134
RMW_UXRCE_TOPIC_NAME_MAX_LENGTH);

rmw_microxrcedds_c/src/rmw_microxrcedds_topic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ create_topic(
6969
*custom_node->context->creation_destroy_stream, custom_topic->topic_id,
7070
custom_node->participant_id, rmw_uxrce_entity_naming_buffer, UXR_REPLACE | UXR_REUSE);
7171
#else
72-
char full_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
73-
char type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
72+
static char full_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
73+
static char type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
7474

7575
generate_topic_name(topic_name, full_topic_name, sizeof(full_topic_name));
7676
generate_type_name(message_type_support_callbacks, type_name, sizeof(type_name));

rmw_microxrcedds_c/src/rmw_service.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ rmw_create_service(
118118
*custom_node->context->creation_destroy_stream, custom_service->service_id,
119119
custom_node->participant_id, rmw_uxrce_entity_naming_buffer, UXR_REPLACE | UXR_REUSE);
120120
#else
121-
char req_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
122-
char res_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
121+
static char req_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
122+
static char res_type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];
123123
generate_service_types(
124124
custom_service->type_support_callbacks, req_type_name, res_type_name,
125125
RMW_UXRCE_TYPE_NAME_MAX_LENGTH);
126126

127-
char req_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
128-
char res_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
127+
static char req_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
128+
static char res_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
129129
generate_service_topics(
130130
service_name, req_topic_name, res_topic_name,
131131
RMW_UXRCE_TOPIC_NAME_MAX_LENGTH);

rmw_microxrcedds_c/src/rmw_wait.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ rmw_wait(
3030
rmw_wait_set_t * wait_set,
3131
const rmw_time_t * wait_timeout)
3232
{
33-
(void)services;
34-
(void)clients;
3533
(void)events;
3634
(void)wait_set;
3735

36+
if (!services && !clients && !subscriptions && !guard_conditions) {
37+
return RMW_RET_OK;
38+
}
39+
3840
// Check if timeout
3941
uint64_t timeout;
4042
if (wait_timeout != NULL) {

0 commit comments

Comments
 (0)