Skip to content

Commit e553199

Browse files
committed
Address reviewer feedback
Signed-off-by: Michael Carroll <[email protected]>
1 parent 8a3739f commit e553199

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

rmw/src/message_sequence.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ rmw_message_sequence_init(
3838
RCUTILS_CHECK_ALLOCATOR(allocator, return RMW_RET_INVALID_ARGUMENT);
3939

4040
void * data = NULL;
41-
if (size) {
41+
if (size > 0u) {
4242
data = allocator->allocate(sizeof(void *) * size, allocator->state);
43-
if (!data) {
43+
if (NULL == data) {
4444
return RMW_RET_BAD_ALLOC;
4545
}
4646
}
4747

4848
sequence->data = data;
49-
sequence->size = 0;
49+
sequence->size = 0u;
5050
sequence->capacity = size;
5151
sequence->allocator = allocator;
5252

@@ -58,8 +58,8 @@ rmw_message_sequence_fini(rmw_message_sequence_t * sequence)
5858
{
5959
RCUTILS_CHECK_ARGUMENT_FOR_NULL(sequence, RMW_RET_INVALID_ARGUMENT);
6060

61-
if (sequence->data) {
62-
assert(sequence->capacity > 0);
61+
if (NULL != sequence->data) {
62+
assert(sequence->capacity > 0u);
6363
RCUTILS_CHECK_ALLOCATOR(sequence->allocator, return RMW_RET_INVALID_ARGUMENT);
6464
sequence->allocator->deallocate(sequence->data, sequence->allocator->state);
6565
}
@@ -95,9 +95,9 @@ rmw_message_info_sequence_init(
9595
RCUTILS_CHECK_ALLOCATOR(allocator, return RMW_RET_INVALID_ARGUMENT);
9696

9797
rmw_message_info_t * data = NULL;
98-
if (size) {
98+
if (size > 0u) {
9999
data = allocator->allocate(sizeof(rmw_message_info_t) * size, allocator->state);
100-
if (!data) {
100+
if (NULL == data) {
101101
return RMW_RET_BAD_ALLOC;
102102
}
103103
}
@@ -114,8 +114,8 @@ rmw_message_info_sequence_fini(rmw_message_info_sequence_t * sequence)
114114
{
115115
RCUTILS_CHECK_ARGUMENT_FOR_NULL(sequence, RMW_RET_INVALID_ARGUMENT);
116116

117-
if (sequence->data) {
118-
assert(sequence->capacity > 0);
117+
if (NULL != sequence->data) {
118+
assert(sequence->capacity > 0u);
119119
RCUTILS_CHECK_ALLOCATOR(sequence->allocator, return RMW_RET_INVALID_ARGUMENT);
120120
sequence->allocator->deallocate(sequence->data, sequence->allocator->state);
121121
}

0 commit comments

Comments
 (0)