From 0df4d0a8f06e272f65f822f520588e4a8b37474f Mon Sep 17 00:00:00 2001 From: Splinter1984 Date: Wed, 28 Jun 2023 10:30:38 +0200 Subject: [PATCH 1/5] Fix MISRA rule 8-3(1/2) 'declarations of a function same name and type' --- .github/codeql/resolved-misra-rules.yml | 2 + src/core/cdr/include/dds/cdr/dds_cdrstream.h | 30 +++---- src/core/cdr/src/dds_cdrstream.c | 20 ++--- src/core/cdr/src/dds_cdrstream_keys.part.c | 10 +-- src/core/ddsc/include/dds/dds.h | 6 +- .../ddsc/include/dds/ddsc/dds_public_status.h | 44 +++++----- src/core/ddsc/include/dds/ddsc/dds_rhc.h | 8 +- src/core/ddsc/src/dds__builtin.h | 4 +- src/core/ddsc/src/dds__data_allocator.h | 4 +- src/core/ddsc/src/dds__entity.h | 4 +- src/core/ddsc/src/dds__handles.h | 6 +- src/core/ddsc/src/dds__publisher.h | 4 +- src/core/ddsc/src/dds__reader.h | 2 +- src/core/ddsc/src/dds_domain.c | 24 +++--- src/core/ddsc/src/dds_entity.c | 4 +- src/core/ddsc/src/dds_guardcond.c | 16 ++-- src/core/ddsc/src/dds_publisher.c | 10 +-- src/core/ddsc/src/dds_read.c | 80 +++++++++---------- src/core/ddsc/src/dds_readcond.c | 4 +- src/core/ddsc/src/dds_reader.c | 12 +-- src/core/ddsc/src/dds_topic.c | 12 +-- src/core/ddsc/src/dds_waitset.c | 4 +- src/core/ddsc/src/dds_whc.c | 20 ++--- src/core/ddsc/src/dds_write.c | 4 +- src/ddsrt/include/dds/ddsrt/avl.h | 52 ++++++------ src/ddsrt/include/dds/ddsrt/log.h | 6 +- src/ddsrt/src/avl.c | 38 ++++----- src/ddsrt/src/environ.c | 8 +- src/ddsrt/src/expand_vars.c | 8 +- src/ddsrt/src/log.c | 4 +- src/ddsrt/src/retcode.c | 16 ++-- src/ddsrt/src/sockets/posix/gethostname.c | 6 +- src/ddsrt/src/sockets/windows/gethostname.c | 12 +-- src/ddsrt/src/string.c | 22 ++--- src/ddsrt/src/threads.c | 10 +-- src/ddsrt/src/threads/posix/threads.c | 60 +++++++------- src/ddsrt/src/time.c | 12 +-- 37 files changed, 295 insertions(+), 293 deletions(-) diff --git a/.github/codeql/resolved-misra-rules.yml b/.github/codeql/resolved-misra-rules.yml index 6b1c20496f..a800aca75b 100644 --- a/.github/codeql/resolved-misra-rules.yml +++ b/.github/codeql/resolved-misra-rules.yml @@ -6,3 +6,5 @@ queries: - uses: ./codeql-coding-standards/c/misra/src/rules/RULE-10-2/AdditionSubtractionOnEssentiallyCharType.ql - uses: ./codeql-coding-standards/c/misra/src/rules/RULE-21-19/ValuesReturnedByLocaleSettingUsedAsPtrToConst.ql - uses: ./codeql-coding-standards/c/misra/src/rules/RULE-17-4/NonVoidFunctionReturnCondition.ql + - uses: ./codeql-coding-standards/c/misra/src/rules/RULE-8-3/DeclarationsOfAFunctionSameNameAndType.ql #[1/2] +# - uses: ./codeql-coding-standards/c/misra/src/rules/RULE-8-3/DeclarationsOfAnObjectSameNameAndType.ql #[2/2] diff --git a/src/core/cdr/include/dds/cdr/dds_cdrstream.h b/src/core/cdr/include/dds/cdr/dds_cdrstream.h index 68f903d739..1573dcd5d3 100644 --- a/src/core/cdr/include/dds/cdr/dds_cdrstream.h +++ b/src/core/cdr/include/dds/cdr/dds_cdrstream.h @@ -149,12 +149,12 @@ dds_ostream_t dds_ostream_from_buffer(void *buffer, size_t size, uint16_t write_ * @param size size of the data * @param bswap byte-swapping required * @param xcdr_version XCDR version of the CDR data - * @param type type descriptor + * @param desc type descriptor * @param just_key indicates if the data is a serialized key or a complete sample * @param actual_size is set to the actual size of the data (*actual_size <= size) on successful return * @returns True iff validation and normalization succeeded */ -DDS_EXPORT bool dds_stream_normalize (void * __restrict data, uint32_t size, bool bswap, uint32_t xcdr_version, const struct dds_cdrstream_desc * __restrict type, bool just_key, uint32_t * __restrict actual_size) ddsrt_attribute_warn_unused_result ddsrt_nonnull_all; +DDS_EXPORT bool dds_stream_normalize (void * __restrict data, uint32_t size, bool bswap, uint32_t xcdr_version, const struct dds_cdrstream_desc * __restrict desc, bool just_key, uint32_t * __restrict actual_size) ddsrt_attribute_warn_unused_result ddsrt_nonnull_all; /** @component cdr_serializer */ DDS_EXPORT const uint32_t *dds_stream_normalize_data (char * __restrict data, uint32_t * __restrict off, uint32_t size, bool bswap, uint32_t xcdr_version, const uint32_t * __restrict ops) ddsrt_attribute_warn_unused_result ddsrt_nonnull_all; @@ -172,16 +172,16 @@ DDS_EXPORT const uint32_t *dds_stream_writeBE (dds_ostreamBE_t * __restrict os, DDS_EXPORT const uint32_t * dds_stream_write_with_byte_order (dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const char * __restrict data, const uint32_t * __restrict ops, enum ddsrt_byte_order_selector bo); /** @component cdr_serializer */ -DDS_EXPORT bool dds_stream_write_sample (dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const void * __restrict data, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT bool dds_stream_write_sample (dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const void * __restrict data, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -DDS_EXPORT bool dds_stream_write_sampleLE (dds_ostreamLE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const void * __restrict data, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT bool dds_stream_write_sampleLE (dds_ostreamLE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const void * __restrict data, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -DDS_EXPORT bool dds_stream_write_sampleBE (dds_ostreamBE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const void * __restrict data, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT bool dds_stream_write_sampleBE (dds_ostreamBE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const void * __restrict data, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -DDS_EXPORT void dds_stream_read_sample (dds_istream_t * __restrict is, void * __restrict data, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT void dds_stream_read_sample (dds_istream_t * __restrict is, void * __restrict data, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ DDS_EXPORT void dds_stream_free_sample (void * __restrict data, const struct dds_cdrstream_allocator * __restrict allocator, const uint32_t * __restrict ops); @@ -193,34 +193,34 @@ DDS_EXPORT uint32_t dds_stream_countops (const uint32_t * __restrict ops, uint32 size_t dds_stream_check_optimize (const struct dds_cdrstream_desc * __restrict desc, uint32_t xcdr_version); /** @component cdr_serializer */ -void dds_stream_write_key (dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const char * __restrict sample, const struct dds_cdrstream_desc * __restrict type); +void dds_stream_write_key (dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const char * __restrict sample, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -void dds_stream_write_keyBE (dds_ostreamBE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const char * __restrict sample, const struct dds_cdrstream_desc * __restrict type); +void dds_stream_write_keyBE (dds_ostreamBE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const char * __restrict sample, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -DDS_EXPORT bool dds_stream_extract_key_from_data (dds_istream_t * __restrict is, dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT bool dds_stream_extract_key_from_data (dds_istream_t * __restrict is, dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -DDS_EXPORT void dds_stream_extract_key_from_key (dds_istream_t * __restrict is, dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT void dds_stream_extract_key_from_key (dds_istream_t * __restrict is, dds_ostream_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -DDS_EXPORT bool dds_stream_extract_keyBE_from_data (dds_istream_t * __restrict is, dds_ostreamBE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT bool dds_stream_extract_keyBE_from_data (dds_istream_t * __restrict is, dds_ostreamBE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -DDS_EXPORT void dds_stream_extract_keyBE_from_key (dds_istream_t * __restrict is, dds_ostreamBE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT void dds_stream_extract_keyBE_from_key (dds_istream_t * __restrict is, dds_ostreamBE_t * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ DDS_EXPORT const uint32_t *dds_stream_read (dds_istream_t * __restrict is, char * __restrict data, const struct dds_cdrstream_allocator * __restrict allocator, const uint32_t * __restrict ops); /** @component cdr_serializer */ -DDS_EXPORT void dds_stream_read_key (dds_istream_t * __restrict is, char * __restrict sample, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict type); +DDS_EXPORT void dds_stream_read_key (dds_istream_t * __restrict is, char * __restrict sample, const struct dds_cdrstream_allocator * __restrict allocator, const struct dds_cdrstream_desc * __restrict desc); /** @component cdr_serializer */ -DDS_EXPORT size_t dds_stream_print_key (dds_istream_t * __restrict is, const struct dds_cdrstream_desc * __restrict type, char * __restrict buf, size_t size); +DDS_EXPORT size_t dds_stream_print_key (dds_istream_t * __restrict is, const struct dds_cdrstream_desc * __restrict desc, char * __restrict buf, size_t size); /** @component cdr_serializer */ -DDS_EXPORT size_t dds_stream_print_sample (dds_istream_t * __restrict is, const struct dds_cdrstream_desc * __restrict type, char * __restrict buf, size_t size); +DDS_EXPORT size_t dds_stream_print_sample (dds_istream_t * __restrict is, const struct dds_cdrstream_desc * __restrict desc, char * __restrict buf, size_t size); /** @component cdr_serializer */ uint16_t dds_stream_minimum_xcdr_version (const uint32_t * __restrict ops); diff --git a/src/core/cdr/src/dds_cdrstream.c b/src/core/cdr/src/dds_cdrstream.c index 0f51ef6275..534290ab87 100644 --- a/src/core/cdr/src/dds_cdrstream.c +++ b/src/core/cdr/src/dds_cdrstream.c @@ -4312,10 +4312,10 @@ static const uint32_t * dds_stream_print_sample1 (char * __restrict *buf, size_t return ops; } -size_t dds_stream_print_sample (dds_istream_t * __restrict is, const struct dds_cdrstream_desc * __restrict desc, char * __restrict buf, size_t bufsize) +size_t dds_stream_print_sample (dds_istream_t * __restrict is, const struct dds_cdrstream_desc * __restrict desc, char * __restrict buf, size_t size) { - (void) dds_stream_print_sample1 (&buf, &bufsize, is, desc->ops.ops, true, false); - return bufsize; + (void) dds_stream_print_sample1 (&buf, &size, is, desc->ops.ops, true, false); + return size; } static void dds_stream_print_key_impl (dds_istream_t * __restrict is, const uint32_t *ops, uint16_t key_offset_count, const uint32_t * key_offset_insn, @@ -4344,25 +4344,25 @@ static void dds_stream_print_key_impl (dds_istream_t * __restrict is, const uint } } -size_t dds_stream_print_key (dds_istream_t * __restrict is, const struct dds_cdrstream_desc * __restrict desc, char * __restrict buf, size_t bufsize) +size_t dds_stream_print_key (dds_istream_t * __restrict is, const struct dds_cdrstream_desc * __restrict desc, char * __restrict buf, size_t size) { - bool cont = prtf (&buf, &bufsize, ":k:{"); + bool cont = prtf (&buf, &size, ":k:{"); bool needs_comma = false; for (uint32_t i = 0; cont && i < desc->keys.nkeys; i++) { if (needs_comma) - (void) prtf (&buf, &bufsize, ","); + (void) prtf (&buf, &size, ","); needs_comma = true; const uint32_t *op = desc->ops.ops + desc->keys.keys[i].ops_offs; switch (DDS_OP (*op)) { case DDS_OP_KOF: { uint16_t n_offs = DDS_OP_LENGTH (*op); - dds_stream_print_key_impl (is, desc->ops.ops + op[1], --n_offs, op + 2, &buf, &bufsize, &cont); + dds_stream_print_key_impl (is, desc->ops.ops + op[1], --n_offs, op + 2, &buf, &size, &cont); break; } case DDS_OP_ADR: { - dds_stream_print_key_impl (is, op, 0, NULL, &buf, &bufsize, &cont); + dds_stream_print_key_impl (is, op, 0, NULL, &buf, &size, &cont); break; } default: @@ -4370,8 +4370,8 @@ size_t dds_stream_print_key (dds_istream_t * __restrict is, const struct dds_cdr break; } } - (void) prtf (&buf, &bufsize, "}"); - return bufsize; + (void) prtf (&buf, &size, "}"); + return size; } /* Gets the (minimum) extensibility of the types used for this topic, and returns the XCDR diff --git a/src/core/cdr/src/dds_cdrstream_keys.part.c b/src/core/cdr/src/dds_cdrstream_keys.part.c index 527c45f9ac..d96a83e63e 100644 --- a/src/core/cdr/src/dds_cdrstream_keys.part.c +++ b/src/core/cdr/src/dds_cdrstream_keys.part.c @@ -316,7 +316,7 @@ static const uint32_t *dds_stream_extract_keyBO_from_data_pl (dds_istream_t * __ static const uint32_t *dds_stream_extract_keyBO_from_data1 (dds_istream_t * __restrict is, DDS_OSTREAM_T * __restrict os, const struct dds_cdrstream_allocator * __restrict allocator, uint32_t ops_offs_idx, uint32_t * __restrict ops_offs, const uint32_t * const __restrict op0, const uint32_t * const __restrict op0_type, const uint32_t * __restrict ops, bool mutable_member, bool mutable_member_or_parent, - uint32_t n_keys, uint32_t * __restrict keys_remaining, const dds_cdrstream_desc_key_t * __restrict keys, struct key_off_info * __restrict key_offs) + uint32_t n_keys, uint32_t * __restrict keys_remaining, const dds_cdrstream_desc_key_t * __restrict key, struct key_off_info * __restrict key_offs) { uint32_t insn; while ((insn = *ops) != DDS_OP_RTS) @@ -324,20 +324,20 @@ static const uint32_t *dds_stream_extract_keyBO_from_data1 (dds_istream_t * __re switch (DDS_OP (insn)) { case DDS_OP_ADR: - ops = dds_stream_extract_keyBO_from_data_adr (insn, is, os, allocator, ops_offs_idx, ops_offs, op0, op0_type, ops, mutable_member, mutable_member_or_parent, n_keys, keys_remaining, keys, key_offs); + ops = dds_stream_extract_keyBO_from_data_adr (insn, is, os, allocator, ops_offs_idx, ops_offs, op0, op0_type, ops, mutable_member, mutable_member_or_parent, n_keys, keys_remaining, key, key_offs); break; case DDS_OP_JSR: - (void) dds_stream_extract_keyBO_from_data1 (is, os, allocator, ops_offs_idx, ops_offs, op0, op0_type, ops + DDS_OP_JUMP (insn), mutable_member, mutable_member_or_parent, n_keys, keys_remaining, keys, key_offs); + (void) dds_stream_extract_keyBO_from_data1 (is, os, allocator, ops_offs_idx, ops_offs, op0, op0_type, ops + DDS_OP_JUMP (insn), mutable_member, mutable_member_or_parent, n_keys, keys_remaining, key, key_offs); ops++; break; case DDS_OP_RTS: case DDS_OP_JEQ: case DDS_OP_JEQ4: case DDS_OP_KOF: case DDS_OP_PLM: abort (); break; case DDS_OP_DLC: - ops = dds_stream_extract_keyBO_from_data_delimited (is, os, allocator, ops_offs_idx, ops_offs, op0, ops, ops, mutable_member_or_parent, n_keys, keys_remaining, keys, key_offs); + ops = dds_stream_extract_keyBO_from_data_delimited (is, os, allocator, ops_offs_idx, ops_offs, op0, ops, ops, mutable_member_or_parent, n_keys, keys_remaining, key, key_offs); break; case DDS_OP_PLC: - ops = dds_stream_extract_keyBO_from_data_pl (is, os, allocator, ops_offs_idx, ops_offs, op0, ops, ops, n_keys, keys_remaining, keys, key_offs); + ops = dds_stream_extract_keyBO_from_data_pl (is, os, allocator, ops_offs_idx, ops_offs, op0, ops, ops, n_keys, keys_remaining, key, key_offs); break; } } diff --git a/src/core/ddsc/include/dds/dds.h b/src/core/ddsc/include/dds/dds.h index 3a4023f7e7..ee8d251197 100644 --- a/src/core/ddsc/include/dds/dds.h +++ b/src/core/ddsc/include/dds/dds.h @@ -1388,7 +1388,7 @@ dds_create_topic_sertype ( struct ddsi_sertype **sertype, const dds_qos_t *qos, const dds_listener_t *listener, - const struct ddsi_plist *sedp_plist); + const ddsi_plist_t *sedp_plist); /** * @brief Finds a locally created or discovered remote topic by topic name and type information @@ -4155,7 +4155,7 @@ dds_lookup_instance(dds_entity_t entity, const void *data); * @component data_instance * * @param[in] entity Reader, writer, readcondition or querycondition entity. - * @param[in] inst Instance handle. + * @param[in] ih Instance handle. * @param[out] data pointer to an instance, to which the key ID corresponding to the instance handle will be * returned, the sample in the instance should be ignored. * @@ -4173,7 +4173,7 @@ dds_lookup_instance(dds_entity_t entity, const void *data); DDS_EXPORT dds_return_t dds_instance_get_key( dds_entity_t entity, - dds_instance_handle_t inst, + dds_instance_handle_t ih, void *data); /** diff --git a/src/core/ddsc/include/dds/ddsc/dds_public_status.h b/src/core/ddsc/include/dds/ddsc/dds_public_status.h index cc71cceb84..67845be6d8 100644 --- a/src/core/ddsc/include/dds/ddsc/dds_public_status.h +++ b/src/core/ddsc/include/dds/ddsc/dds_public_status.h @@ -202,7 +202,7 @@ dds_inconsistent_topic_status_t; * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] topic The entity to get the status + * @param[in] entity The topic entity to get the status * @param[out] status The pointer to @ref dds_inconsistent_topic_status_t to get the status * * @returns 0 - Success @@ -219,7 +219,7 @@ dds_inconsistent_topic_status_t; */ DDS_EXPORT dds_return_t dds_get_inconsistent_topic_status ( - dds_entity_t topic, + dds_entity_t entity, dds_inconsistent_topic_status_t * status); /** @@ -231,7 +231,7 @@ dds_get_inconsistent_topic_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] writer The entity to get the status + * @param[in] entity The writer entity to get the status * @param[out] status The pointer to @ref dds_publication_matched_status_t to get the status * * @returns 0 - Success @@ -248,7 +248,7 @@ dds_get_inconsistent_topic_status ( */ DDS_EXPORT dds_return_t dds_get_publication_matched_status ( - dds_entity_t writer, + dds_entity_t entity, dds_publication_matched_status_t * status); /** @@ -260,7 +260,7 @@ dds_get_publication_matched_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] writer The entity to get the status + * @param[in] entity The writer entity to get the status * @param[out] status The pointer to @ref dds_liveliness_lost_status_t to get the status * * @returns 0 - Success @@ -277,7 +277,7 @@ dds_get_publication_matched_status ( */ DDS_EXPORT dds_return_t dds_get_liveliness_lost_status ( - dds_entity_t writer, + dds_entity_t entity, dds_liveliness_lost_status_t * status); /** @@ -289,7 +289,7 @@ dds_get_liveliness_lost_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] writer The entity to get the status + * @param[in] entity The writer entity to get the status * @param[out] status The pointer to @ref dds_offered_deadline_missed_status_t to get the status * * @returns 0 - Success @@ -306,7 +306,7 @@ dds_get_liveliness_lost_status ( */ DDS_EXPORT dds_return_t dds_get_offered_deadline_missed_status( - dds_entity_t writer, + dds_entity_t entity, dds_offered_deadline_missed_status_t *status); /** @@ -318,7 +318,7 @@ dds_get_offered_deadline_missed_status( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] writer The writer entity to get the status + * @param[in] entity The writer entity to get the status * @param[out] status The pointer to @ref dds_offered_incompatible_qos_status_t to get the status * * @returns 0 - Success @@ -335,7 +335,7 @@ dds_get_offered_deadline_missed_status( */ DDS_EXPORT dds_return_t dds_get_offered_incompatible_qos_status ( - dds_entity_t writer, + dds_entity_t entity, dds_offered_incompatible_qos_status_t * status); /** @@ -347,7 +347,7 @@ dds_get_offered_incompatible_qos_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] reader The reader entity to get the status + * @param[in] entity The reader entity to get the status * @param[out] status The pointer to @ref dds_subscription_matched_status_t to get the status * * @returns 0 - Success @@ -364,7 +364,7 @@ dds_get_offered_incompatible_qos_status ( */ DDS_EXPORT dds_return_t dds_get_subscription_matched_status ( - dds_entity_t reader, + dds_entity_t entity, dds_subscription_matched_status_t * status); /** @@ -376,7 +376,7 @@ dds_get_subscription_matched_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] reader The entity to get the status + * @param[in] entity The reader entity to get the status * @param[out] status The pointer to @ref dds_liveliness_changed_status_t to get the status * * @returns 0 - Success @@ -393,7 +393,7 @@ dds_get_subscription_matched_status ( */ DDS_EXPORT dds_return_t dds_get_liveliness_changed_status ( - dds_entity_t reader, + dds_entity_t entity, dds_liveliness_changed_status_t * status); /** @@ -405,7 +405,7 @@ dds_get_liveliness_changed_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] reader The entity to get the status + * @param[in] entity The reader entity to get the status * @param[out] status The pointer to @ref dds_sample_rejected_status_t to get the status * * @returns 0 - Success @@ -422,7 +422,7 @@ dds_get_liveliness_changed_status ( */ DDS_EXPORT dds_return_t dds_get_sample_rejected_status ( - dds_entity_t reader, + dds_entity_t entity, dds_sample_rejected_status_t * status); /** @@ -434,7 +434,7 @@ dds_get_sample_rejected_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] reader The entity to get the status + * @param[in] entity The reader entity to get the status * @param[out] status The pointer to @ref dds_sample_lost_status_t to get the status * * @returns A dds_return_t indicating success or failure @@ -452,7 +452,7 @@ dds_get_sample_rejected_status ( */ DDS_EXPORT dds_return_t dds_get_sample_lost_status ( - dds_entity_t reader, + dds_entity_t entity, dds_sample_lost_status_t * status); /** @@ -464,7 +464,7 @@ dds_get_sample_lost_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] reader The entity to get the status + * @param[in] entity The reader entity to get the status * @param[out] status The pointer to @ref dds_requested_deadline_missed_status_t to get the status * * @returns A dds_return_t indicating success or failure @@ -482,7 +482,7 @@ dds_get_sample_lost_status ( */ DDS_EXPORT dds_return_t dds_get_requested_deadline_missed_status ( - dds_entity_t reader, + dds_entity_t entity, dds_requested_deadline_missed_status_t * status); /** @@ -494,7 +494,7 @@ dds_get_requested_deadline_missed_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] reader The entity to get the status + * @param[in] entity The reader entity to get the status * @param[out] status The pointer to @ref dds_requested_incompatible_qos_status_t to get the status * * @returns A dds_return_t indicating success or failure @@ -512,7 +512,7 @@ dds_get_requested_deadline_missed_status ( */ DDS_EXPORT dds_return_t dds_get_requested_incompatible_qos_status ( - dds_entity_t reader, + dds_entity_t entity, dds_requested_incompatible_qos_status_t * status); #if defined (__cplusplus) diff --git a/src/core/ddsc/include/dds/ddsc/dds_rhc.h b/src/core/ddsc/include/dds/ddsc/dds_rhc.h index a376ce2eed..1ecd459065 100644 --- a/src/core/ddsc/include/dds/ddsc/dds_rhc.h +++ b/src/core/ddsc/include/dds/ddsc/dds_rhc.h @@ -63,13 +63,13 @@ DDS_INLINE_EXPORT inline dds_return_t dds_rhc_associate (struct dds_rhc *rhc, st } /** @component rhc */ -DDS_INLINE_EXPORT inline bool dds_rhc_store (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wrinfo, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk) { - return rhc->common.ops->rhc_ops.store (&rhc->common.rhc, wrinfo, sample, tk); +DDS_INLINE_EXPORT inline bool dds_rhc_store (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict pwr_info, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk) { + return rhc->common.ops->rhc_ops.store (&rhc->common.rhc, pwr_info, sample, tk); } /** @component rhc */ -DDS_INLINE_EXPORT inline void dds_rhc_unregister_wr (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wrinfo) { - rhc->common.ops->rhc_ops.unregister_wr (&rhc->common.rhc, wrinfo); +DDS_INLINE_EXPORT inline void dds_rhc_unregister_wr (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict pwr_info) { + rhc->common.ops->rhc_ops.unregister_wr (&rhc->common.rhc, pwr_info); } /** @component rhc */ diff --git a/src/core/ddsc/src/dds__builtin.h b/src/core/ddsc/src/dds__builtin.h index d71b426c88..e265d08bb8 100644 --- a/src/core/ddsc/src/dds__builtin.h +++ b/src/core/ddsc/src/dds__builtin.h @@ -42,11 +42,11 @@ dds_entity_t dds__get_builtin_topic_pseudo_handle_from_typename (const char *typ * @brief Get actual topic in related participant related to topic 'id'. * @component builtin_topic * - * @param e entity to get the built-in topic from + * @param entity entity to get the built-in topic from * @param topic pseudo handle to get the actual built-in topic for * @returns the built-in topic entity */ -dds_entity_t dds__get_builtin_topic (dds_entity_t e, dds_entity_t topic); +dds_entity_t dds__get_builtin_topic (dds_entity_t entity, dds_entity_t topic); /** * @brief Constructs the QoS object for a built-in topic QoS diff --git a/src/core/ddsc/src/dds__data_allocator.h b/src/core/ddsc/src/dds__data_allocator.h index 8d3973333d..70a11770ea 100644 --- a/src/core/ddsc/src/dds__data_allocator.h +++ b/src/core/ddsc/src/dds__data_allocator.h @@ -56,11 +56,11 @@ dds_return_t dds__writer_data_allocator_fini (const struct dds_writer *wr, dds_d ddsrt_nonnull_all; /** @component data_alloc */ -dds_return_t dds__reader_data_allocator_init (const struct dds_reader *wr, dds_data_allocator_t *data_allocator) +dds_return_t dds__reader_data_allocator_init (const struct dds_reader *rd, dds_data_allocator_t *data_allocator) ddsrt_nonnull_all; /** @component data_alloc */ -dds_return_t dds__reader_data_allocator_fini (const struct dds_reader *wr, dds_data_allocator_t *data_allocator) +dds_return_t dds__reader_data_allocator_fini (const struct dds_reader *rd, dds_data_allocator_t *data_allocator) ddsrt_nonnull_all; #if defined (__cplusplus) diff --git a/src/core/ddsc/src/dds__entity.h b/src/core/ddsc/src/dds__entity.h index 71af771708..f7604b3137 100644 --- a/src/core/ddsc/src/dds__entity.h +++ b/src/core/ddsc/src/dds__entity.h @@ -77,7 +77,7 @@ inline bool dds_entity_is_enabled (const dds_entity *e) { } /** @component generic_entity */ -bool dds_entity_status_set (dds_entity *e, status_mask_t t) ddsrt_attribute_warn_unused_result; +bool dds_entity_status_set (dds_entity *e, status_mask_t status) ddsrt_attribute_warn_unused_result; /** @component generic_entity */ inline void dds_entity_status_reset (dds_entity *e, status_mask_t t) { @@ -204,7 +204,7 @@ dds_return_t dds_entity_pin_for_delete (dds_entity_t hdl, bool explicit, bool fr void dds_entity_unpin (dds_entity *e); /** @component generic_entity */ -dds_return_t dds_entity_lock (dds_entity_t hdl, dds_entity_kind_t kind, dds_entity **e); +dds_return_t dds_entity_lock (dds_entity_t hdl, dds_entity_kind_t kind, dds_entity **eptr); /** @component generic_entity */ void dds_entity_unlock (dds_entity *e); diff --git a/src/core/ddsc/src/dds__handles.h b/src/core/ddsc/src/dds__handles.h index 68d832f12e..430008e746 100644 --- a/src/core/ddsc/src/dds__handles.h +++ b/src/core/ddsc/src/dds__handles.h @@ -157,13 +157,13 @@ int32_t dds_handle_delete(struct dds_handle_link *link); * * Returns OK when succeeded. */ -int32_t dds_handle_pin(dds_handle_t hdl, struct dds_handle_link **entity); +int32_t dds_handle_pin(dds_handle_t hdl, struct dds_handle_link **link); /** @component handles */ -int32_t dds_handle_pin_with_origin(dds_handle_t hdl, bool from_user, struct dds_handle_link **entity); +int32_t dds_handle_pin_with_origin(dds_handle_t hdl, bool from_user, struct dds_handle_link **link); /** @component handles */ -int32_t dds_handle_pin_and_ref_with_origin(dds_handle_t hdl, bool from_user, struct dds_handle_link **entity); +int32_t dds_handle_pin_and_ref_with_origin(dds_handle_t hdl, bool from_user, struct dds_handle_link **link); /** @component handles */ void dds_handle_repin(struct dds_handle_link *link); diff --git a/src/core/ddsc/src/dds__publisher.h b/src/core/ddsc/src/dds__publisher.h index 3a90f865d9..5ab9845f3f 100644 --- a/src/core/ddsc/src/dds__publisher.h +++ b/src/core/ddsc/src/dds__publisher.h @@ -33,10 +33,10 @@ DEFINE_ENTITY_LOCK_UNLOCK(dds_publisher, DDS_KIND_PUBLISHER, publisher) dds_entity_t dds__create_publisher_l(struct dds_participant *participant, bool implicit, const dds_qos_t *qos, const dds_listener_t *listener); /** @component publisher */ -dds_return_t dds_publisher_begin_coherent (dds_entity_t e); +dds_return_t dds_publisher_begin_coherent (dds_entity_t publisher); /** @component publisher */ -dds_return_t dds_publisher_end_coherent (dds_entity_t e); +dds_return_t dds_publisher_end_coherent (dds_entity_t publisher); #if defined (__cplusplus) } diff --git a/src/core/ddsc/src/dds__reader.h b/src/core/ddsc/src/dds__reader.h index 575786b559..5df36e61e1 100644 --- a/src/core/ddsc/src/dds__reader.h +++ b/src/core/ddsc/src/dds__reader.h @@ -20,7 +20,7 @@ extern "C" { struct ddsi_status_cb_data; /** @component reader */ -void dds_reader_status_cb (void *entity, const struct ddsi_status_cb_data * data); +void dds_reader_status_cb (void *entity, const ddsi_status_cb_data_t * data); /** @component reader */ dds_return_t dds_return_reader_loan (dds_reader *rd, void **buf, int32_t bufsz); diff --git a/src/core/ddsc/src/dds_domain.c b/src/core/ddsc/src/dds_domain.c index 4d0df9cf4e..9ebb9d0bab 100644 --- a/src/core/ddsc/src/dds_domain.c +++ b/src/core/ddsc/src/dds_domain.c @@ -270,13 +270,13 @@ static dds_entity_t dds_domain_create_internal_xml_or_raw (dds_domain **domain_o return domh; } -dds_entity_t dds_domain_create_internal (dds_domain **domain_out, dds_domainid_t id, bool implicit, const char *config_xml) +dds_entity_t dds_domain_create_internal (dds_domain **domain_out, dds_domainid_t id, bool implicit, const char *config) { - const struct config_source config = { .kind = CFGKIND_XML, .u = { .xml = config_xml } }; - return dds_domain_create_internal_xml_or_raw (domain_out, id, implicit, &config); + const struct config_source config_src = { .kind = CFGKIND_XML, .u = { .xml = config } }; + return dds_domain_create_internal_xml_or_raw (domain_out, id, implicit, &config_src); } -dds_entity_t dds_create_domain (const dds_domainid_t domain, const char *config_xml) +dds_entity_t dds_create_domain (const dds_domainid_t domain, const char *config) { dds_domain *dom; dds_entity_t ret; @@ -284,35 +284,35 @@ dds_entity_t dds_create_domain (const dds_domainid_t domain, const char *config_ if (domain == DDS_DOMAIN_DEFAULT) return DDS_RETCODE_BAD_PARAMETER; - if (config_xml == NULL) - config_xml = ""; + if (config == NULL) + config = ""; /* Make sure DDS instance is initialized. */ if ((ret = dds_init ()) < 0) return ret; - const struct config_source config = { .kind = CFGKIND_XML, .u = { .xml = config_xml } }; - ret = dds_domain_create_internal_xml_or_raw (&dom, domain, false, &config); + const struct config_source config_src = { .kind = CFGKIND_XML, .u = { .xml = config } }; + ret = dds_domain_create_internal_xml_or_raw (&dom, domain, false, &config_src); dds_entity_unpin_and_drop_ref (&dds_global.m_entity); return ret; } -dds_entity_t dds_create_domain_with_rawconfig (const dds_domainid_t domain, const struct ddsi_config *config_raw) +dds_entity_t dds_create_domain_with_rawconfig (const dds_domainid_t domain, const struct ddsi_config *config) { dds_domain *dom; dds_entity_t ret; if (domain == DDS_DOMAIN_DEFAULT) return DDS_RETCODE_BAD_PARAMETER; - if (config_raw == NULL) + if (config == NULL) return DDS_RETCODE_BAD_PARAMETER; /* Make sure DDS instance is initialized. */ if ((ret = dds_init ()) < 0) return ret; - const struct config_source config = { .kind = CFGKIND_RAW, .u = { .raw = config_raw } }; - ret = dds_domain_create_internal_xml_or_raw (&dom, domain, false, &config); + const struct config_source config_src = { .kind = CFGKIND_RAW, .u = { .raw = config } }; + ret = dds_domain_create_internal_xml_or_raw (&dom, domain, false, &config_src); dds_entity_unpin_and_drop_ref (&dds_global.m_entity); return ret; } diff --git a/src/core/ddsc/src/dds_entity.c b/src/core/ddsc/src/dds_entity.c index 546d8bda0f..28a064c00d 100644 --- a/src/core/ddsc/src/dds_entity.c +++ b/src/core/ddsc/src/dds_entity.c @@ -1735,11 +1735,11 @@ static void pushdown_write_flush (dds_entity *e) ddsrt_mutex_unlock (&e->m_mutex); } -dds_return_t dds_write_flush (dds_entity_t entity) +dds_return_t dds_write_flush (dds_entity_t writer) { dds_entity *e; dds_return_t rc; - if ((rc = dds_entity_pin (entity, &e)) != DDS_RETCODE_OK) + if ((rc = dds_entity_pin (writer, &e)) != DDS_RETCODE_OK) return rc; struct ddsi_thread_state * const thrst = ddsi_lookup_thread_state (); ddsi_thread_state_awake (thrst, &e->m_domain->gv); diff --git a/src/core/ddsc/src/dds_guardcond.c b/src/core/ddsc/src/dds_guardcond.c index 46ceb4902f..aa27d86102 100644 --- a/src/core/ddsc/src/dds_guardcond.c +++ b/src/core/ddsc/src/dds_guardcond.c @@ -31,7 +31,7 @@ const struct dds_entity_deriver dds_entity_deriver_guardcondition = { .refresh_statistics = dds_entity_deriver_dummy_refresh_statistics }; -dds_entity_t dds_create_guardcondition (dds_entity_t owner) +dds_entity_t dds_create_guardcondition (dds_entity_t participant) { dds_entity *e; dds_return_t rc; @@ -43,7 +43,7 @@ dds_entity_t dds_create_guardcondition (dds_entity_t owner) if ((rc = dds_init ()) < 0) return rc; - if ((rc = dds_entity_lock (owner, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK) + if ((rc = dds_entity_lock (participant, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK) goto err_entity_lock; switch (dds_entity_kind (e)) @@ -73,12 +73,12 @@ dds_entity_t dds_create_guardcondition (dds_entity_t owner) return rc; } -dds_return_t dds_set_guardcondition (dds_entity_t condition, bool triggered) +dds_return_t dds_set_guardcondition (dds_entity_t guardcond, bool triggered) { dds_guardcond *gcond; dds_return_t rc; - if ((rc = dds_guardcond_lock (condition, &gcond)) != DDS_RETCODE_OK) + if ((rc = dds_guardcond_lock (guardcond, &gcond)) != DDS_RETCODE_OK) return rc; else { @@ -96,7 +96,7 @@ dds_return_t dds_set_guardcondition (dds_entity_t condition, bool triggered) } } -dds_return_t dds_read_guardcondition (dds_entity_t condition, bool *triggered) +dds_return_t dds_read_guardcondition (dds_entity_t guardcond, bool *triggered) { dds_guardcond *gcond; dds_return_t rc; @@ -105,7 +105,7 @@ dds_return_t dds_read_guardcondition (dds_entity_t condition, bool *triggered) return DDS_RETCODE_BAD_PARAMETER; *triggered = false; - if ((rc = dds_guardcond_lock (condition, &gcond)) != DDS_RETCODE_OK) + if ((rc = dds_guardcond_lock (guardcond, &gcond)) != DDS_RETCODE_OK) return rc; else { @@ -115,7 +115,7 @@ dds_return_t dds_read_guardcondition (dds_entity_t condition, bool *triggered) } } -dds_return_t dds_take_guardcondition (dds_entity_t condition, bool *triggered) +dds_return_t dds_take_guardcondition (dds_entity_t guardcond, bool *triggered) { dds_guardcond *gcond; dds_return_t rc; @@ -124,7 +124,7 @@ dds_return_t dds_take_guardcondition (dds_entity_t condition, bool *triggered) return DDS_RETCODE_BAD_PARAMETER; *triggered = false; - if ((rc = dds_guardcond_lock (condition, &gcond)) != DDS_RETCODE_OK) + if ((rc = dds_guardcond_lock (guardcond, &gcond)) != DDS_RETCODE_OK) return rc; else { diff --git a/src/core/ddsc/src/dds_publisher.c b/src/core/ddsc/src/dds_publisher.c index 8c1e14dc8a..86bf745bac 100644 --- a/src/core/ddsc/src/dds_publisher.c +++ b/src/core/ddsc/src/dds_publisher.c @@ -47,7 +47,7 @@ const struct dds_entity_deriver dds_entity_deriver_publisher = { .refresh_statistics = dds_entity_deriver_dummy_refresh_statistics }; -dds_entity_t dds__create_publisher_l (dds_participant *par, bool implicit, const dds_qos_t *qos, const dds_listener_t *listener) +dds_entity_t dds__create_publisher_l (dds_participant *participant, bool implicit, const dds_qos_t *qos, const dds_listener_t *listener) { dds_publisher *pub; dds_entity_t hdl; @@ -58,18 +58,18 @@ dds_entity_t dds__create_publisher_l (dds_participant *par, bool implicit, const if (qos) ddsi_xqos_mergein_missing (new_qos, qos, DDS_PUBLISHER_QOS_MASK); ddsi_xqos_mergein_missing (new_qos, &ddsi_default_qos_publisher_subscriber, ~(uint64_t)0); - dds_apply_entity_naming(new_qos, par->m_entity.m_qos, &par->m_entity.m_domain->gv); + dds_apply_entity_naming(new_qos, participant->m_entity.m_qos, &participant->m_entity.m_domain->gv); - if ((ret = ddsi_xqos_valid (&par->m_entity.m_domain->gv.logconfig, new_qos)) != DDS_RETCODE_OK) + if ((ret = ddsi_xqos_valid (&participant->m_entity.m_domain->gv.logconfig, new_qos)) != DDS_RETCODE_OK) { dds_delete_qos (new_qos); return ret; } pub = dds_alloc (sizeof (*pub)); - hdl = dds_entity_init (&pub->m_entity, &par->m_entity, DDS_KIND_PUBLISHER, implicit, true, new_qos, listener, DDS_PUBLISHER_STATUS_MASK); + hdl = dds_entity_init (&pub->m_entity, &participant->m_entity, DDS_KIND_PUBLISHER, implicit, true, new_qos, listener, DDS_PUBLISHER_STATUS_MASK); pub->m_entity.m_iid = ddsi_iid_gen (); - dds_entity_register_child (&par->m_entity, &pub->m_entity); + dds_entity_register_child (&participant->m_entity, &pub->m_entity); dds_entity_init_complete (&pub->m_entity); return hdl; } diff --git a/src/core/ddsc/src/dds_read.c b/src/core/ddsc/src/dds_read.c index ea794808da..c32e447d39 100644 --- a/src/core/ddsc/src/dds_read.c +++ b/src/core/ddsc/src/dds_read.c @@ -179,7 +179,7 @@ static dds_return_t dds_readcdr_impl (bool take, dds_entity_t reader_or_conditio return ret; } -dds_return_t dds_read (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs) +dds_return_t dds_read (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -188,10 +188,10 @@ dds_return_t dds_read (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si /* FIXME: Fix the interface. */ maxs = (uint32_t) bufsz; } - return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false); + return dds_read_impl (false, reader_or_condition, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false); } -dds_return_t dds_read_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, uint32_t maxs) +dds_return_t dds_read_wl (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, uint32_t maxs) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -200,10 +200,10 @@ dds_return_t dds_read_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false); + return dds_read_impl (false, reader_or_condition, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false); } -dds_return_t dds_read_mask (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, uint32_t mask) +dds_return_t dds_read_mask (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, uint32_t mask) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -212,10 +212,10 @@ dds_return_t dds_read_mask (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_ /* FIXME: Fix the interface. */ maxs = (uint32_t)bufsz; } - return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false); + return dds_read_impl (false, reader_or_condition, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false); } -dds_return_t dds_read_mask_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, uint32_t maxs, uint32_t mask) +dds_return_t dds_read_mask_wl (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, uint32_t maxs, uint32_t mask) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -224,10 +224,10 @@ dds_return_t dds_read_mask_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_in /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false); + return dds_read_impl (false, reader_or_condition, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false); } -dds_return_t dds_readcdr (dds_entity_t rd_or_cnd, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, uint32_t mask) +dds_return_t dds_readcdr (dds_entity_t reader_or_condition, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, uint32_t mask) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -236,10 +236,10 @@ dds_return_t dds_readcdr (dds_entity_t rd_or_cnd, struct ddsi_serdata **buf, uin /* FIXME: Fix the interface. */ maxs = 100; } - return dds_readcdr_impl (false, rd_or_cnd, buf, maxs, si, mask, DDS_HANDLE_NIL, lock); + return dds_readcdr_impl (false, reader_or_condition, buf, maxs, si, mask, DDS_HANDLE_NIL, lock); } -dds_return_t dds_read_instance (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, dds_instance_handle_t handle) +dds_return_t dds_read_instance (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, dds_instance_handle_t handle) { bool lock = true; @@ -252,10 +252,10 @@ dds_return_t dds_read_instance (dds_entity_t rd_or_cnd, void **buf, dds_sample_i /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, handle, lock, false); + return dds_read_impl (false, reader_or_condition, buf, bufsz, maxs, si, NO_STATE_MASK_SET, handle, lock, false); } -dds_return_t dds_read_instance_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, uint32_t maxs, dds_instance_handle_t handle) +dds_return_t dds_read_instance_wl (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, uint32_t maxs, dds_instance_handle_t handle) { bool lock = true; @@ -268,10 +268,10 @@ dds_return_t dds_read_instance_wl (dds_entity_t rd_or_cnd, void **buf, dds_sampl /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, handle, lock, false); + return dds_read_impl (false, reader_or_condition, buf, maxs, maxs, si, NO_STATE_MASK_SET, handle, lock, false); } -dds_return_t dds_read_instance_mask (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, dds_instance_handle_t handle, uint32_t mask) +dds_return_t dds_read_instance_mask (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, dds_instance_handle_t handle, uint32_t mask) { bool lock = true; @@ -284,10 +284,10 @@ dds_return_t dds_read_instance_mask (dds_entity_t rd_or_cnd, void **buf, dds_sam /* FIXME: Fix the interface. */ maxs = (uint32_t)bufsz; } - return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, mask, handle, lock, false); + return dds_read_impl (false, reader_or_condition, buf, bufsz, maxs, si, mask, handle, lock, false); } -dds_return_t dds_read_instance_mask_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, uint32_t maxs, dds_instance_handle_t handle, uint32_t mask) +dds_return_t dds_read_instance_mask_wl (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, uint32_t maxs, dds_instance_handle_t handle, uint32_t mask) { bool lock = true; @@ -300,10 +300,10 @@ dds_return_t dds_read_instance_mask_wl (dds_entity_t rd_or_cnd, void **buf, dds_ /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, mask, handle, lock, false); + return dds_read_impl (false, reader_or_condition, buf, maxs, maxs, si, mask, handle, lock, false); } -dds_return_t dds_readcdr_instance (dds_entity_t rd_or_cnd, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, dds_instance_handle_t handle, uint32_t mask) +dds_return_t dds_readcdr_instance (dds_entity_t reader_or_condition, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, dds_instance_handle_t handle, uint32_t mask) { bool lock = true; @@ -316,7 +316,7 @@ dds_return_t dds_readcdr_instance (dds_entity_t rd_or_cnd, struct ddsi_serdata * /* FIXME: Fix the interface. */ maxs = 100; } - return dds_readcdr_impl(false, rd_or_cnd, buf, maxs, si, mask, handle, lock); + return dds_readcdr_impl(false, reader_or_condition, buf, maxs, si, mask, handle, lock); } dds_return_t dds_read_next (dds_entity_t reader, void **buf, dds_sample_info_t *si) @@ -334,7 +334,7 @@ dds_return_t dds_read_next_wl ( return dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true); } -dds_return_t dds_take (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs) +dds_return_t dds_take (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -343,10 +343,10 @@ dds_return_t dds_take (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si /* FIXME: Fix the interface. */ maxs = (uint32_t)bufsz; } - return dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false); + return dds_read_impl (true, reader_or_condition, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false); } -dds_return_t dds_take_wl (dds_entity_t rd_or_cnd, void ** buf, dds_sample_info_t * si, uint32_t maxs) +dds_return_t dds_take_wl (dds_entity_t reader_or_condition, void ** buf, dds_sample_info_t * si, uint32_t maxs) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -355,10 +355,10 @@ dds_return_t dds_take_wl (dds_entity_t rd_or_cnd, void ** buf, dds_sample_info_t /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl (true, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false); + return dds_read_impl (true, reader_or_condition, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false); } -dds_return_t dds_take_mask (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, uint32_t mask) +dds_return_t dds_take_mask (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, uint32_t mask) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -367,10 +367,10 @@ dds_return_t dds_take_mask (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_ /* FIXME: Fix the interface. */ maxs = (uint32_t) bufsz; } - return dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false); + return dds_read_impl (true, reader_or_condition, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false); } -dds_return_t dds_take_mask_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, uint32_t maxs, uint32_t mask) +dds_return_t dds_take_mask_wl (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, uint32_t maxs, uint32_t mask) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -379,10 +379,10 @@ dds_return_t dds_take_mask_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_in /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl (true, rd_or_cnd, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false); + return dds_read_impl (true, reader_or_condition, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false); } -dds_return_t dds_takecdr (dds_entity_t rd_or_cnd, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, uint32_t mask) +dds_return_t dds_takecdr (dds_entity_t reader_or_condition, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, uint32_t mask) { bool lock = true; if (maxs == DDS_READ_WITHOUT_LOCK) @@ -391,10 +391,10 @@ dds_return_t dds_takecdr (dds_entity_t rd_or_cnd, struct ddsi_serdata **buf, uin /* FIXME: Fix the interface. */ maxs = 100; } - return dds_readcdr_impl (true, rd_or_cnd, buf, maxs, si, mask, DDS_HANDLE_NIL, lock); + return dds_readcdr_impl (true, reader_or_condition, buf, maxs, si, mask, DDS_HANDLE_NIL, lock); } -dds_return_t dds_take_instance (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, dds_instance_handle_t handle) +dds_return_t dds_take_instance (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, dds_instance_handle_t handle) { bool lock = true; @@ -407,10 +407,10 @@ dds_return_t dds_take_instance (dds_entity_t rd_or_cnd, void **buf, dds_sample_i /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl(true, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, handle, lock, false); + return dds_read_impl(true, reader_or_condition, buf, bufsz, maxs, si, NO_STATE_MASK_SET, handle, lock, false); } -dds_return_t dds_take_instance_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, uint32_t maxs, dds_instance_handle_t handle) +dds_return_t dds_take_instance_wl (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, uint32_t maxs, dds_instance_handle_t handle) { bool lock = true; @@ -423,10 +423,10 @@ dds_return_t dds_take_instance_wl (dds_entity_t rd_or_cnd, void **buf, dds_sampl /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl(true, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, handle, lock, false); + return dds_read_impl(true, reader_or_condition, buf, maxs, maxs, si, NO_STATE_MASK_SET, handle, lock, false); } -dds_return_t dds_take_instance_mask (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, dds_instance_handle_t handle, uint32_t mask) +dds_return_t dds_take_instance_mask (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, size_t bufsz, uint32_t maxs, dds_instance_handle_t handle, uint32_t mask) { bool lock = true; @@ -439,10 +439,10 @@ dds_return_t dds_take_instance_mask (dds_entity_t rd_or_cnd, void **buf, dds_sam /* FIXME: Fix the interface. */ maxs = (uint32_t)bufsz; } - return dds_read_impl(true, rd_or_cnd, buf, bufsz, maxs, si, mask, handle, lock, false); + return dds_read_impl(true, reader_or_condition, buf, bufsz, maxs, si, mask, handle, lock, false); } -dds_return_t dds_take_instance_mask_wl (dds_entity_t rd_or_cnd, void **buf, dds_sample_info_t *si, uint32_t maxs, dds_instance_handle_t handle, uint32_t mask) +dds_return_t dds_take_instance_mask_wl (dds_entity_t reader_or_condition, void **buf, dds_sample_info_t *si, uint32_t maxs, dds_instance_handle_t handle, uint32_t mask) { bool lock = true; @@ -455,10 +455,10 @@ dds_return_t dds_take_instance_mask_wl (dds_entity_t rd_or_cnd, void **buf, dds_ /* FIXME: Fix the interface. */ maxs = 100; } - return dds_read_impl(true, rd_or_cnd, buf, maxs, maxs, si, mask, handle, lock, false); + return dds_read_impl(true, reader_or_condition, buf, maxs, maxs, si, mask, handle, lock, false); } -dds_return_t dds_takecdr_instance (dds_entity_t rd_or_cnd, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, dds_instance_handle_t handle, uint32_t mask) +dds_return_t dds_takecdr_instance (dds_entity_t reader_or_condition, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, dds_instance_handle_t handle, uint32_t mask) { bool lock = true; @@ -471,7 +471,7 @@ dds_return_t dds_takecdr_instance (dds_entity_t rd_or_cnd, struct ddsi_serdata * /* FIXME: Fix the interface. */ maxs = 100; } - return dds_readcdr_impl(true, rd_or_cnd, buf, maxs, si, mask, handle, lock); + return dds_readcdr_impl(true, reader_or_condition, buf, maxs, si, mask, handle, lock); } dds_return_t dds_take_next (dds_entity_t reader, void **buf, dds_sample_info_t *si) diff --git a/src/core/ddsc/src/dds_readcond.c b/src/core/ddsc/src/dds_readcond.c index 93e29c1d07..00b313ae27 100644 --- a/src/core/ddsc/src/dds_readcond.c +++ b/src/core/ddsc/src/dds_readcond.c @@ -82,11 +82,11 @@ dds_entity_t dds_create_readcondition (dds_entity_t reader, uint32_t mask) } } -dds_entity_t dds_get_datareader (dds_entity_t condition) +dds_entity_t dds_get_datareader (dds_entity_t entity) { struct dds_entity *e; dds_return_t rc; - if ((rc = dds_entity_pin (condition, &e)) != DDS_RETCODE_OK) + if ((rc = dds_entity_pin (entity, &e)) != DDS_RETCODE_OK) return rc; else { diff --git a/src/core/ddsc/src/dds_reader.c b/src/core/ddsc/src/dds_reader.c index b22c66294b..9d7b614459 100644 --- a/src/core/ddsc/src/dds_reader.c +++ b/src/core/ddsc/src/dds_reader.c @@ -372,9 +372,9 @@ STATUS_CB_IMPL (reader, sample_lost, SAMPLE_LOST, STATUS_CB_IMPL (reader, requested_deadline_missed, REQUESTED_DEADLINE_MISSED, total_count_change) STATUS_CB_IMPL (reader, requested_incompatible_qos, REQUESTED_INCOMPATIBLE_QOS, total_count_change) -void dds_reader_status_cb (void *ventity, const ddsi_status_cb_data_t *data) +void dds_reader_status_cb (void *entity, const ddsi_status_cb_data_t *data) { - dds_reader * const rd = ventity; + dds_reader * const rd = entity; /* When data is NULL, it means that the DDSI reader is deleted. */ if (data == NULL) @@ -758,11 +758,11 @@ dds_entity_t dds_create_reader_rhc (dds_entity_t participant_or_subscriber, dds_ return dds_create_reader_int (participant_or_subscriber, topic, qos, listener, rhc); } -uint32_t dds_reader_lock_samples (dds_entity_t reader) +uint32_t dds_reader_lock_samples (dds_entity_t entity) { dds_reader *rd; uint32_t n; - if (dds_reader_lock (reader, &rd) != DDS_RETCODE_OK) + if (dds_reader_lock (entity, &rd) != DDS_RETCODE_OK) return 0; n = dds_rhc_lock_samples (rd->m_rhc); dds_reader_unlock (rd); @@ -821,7 +821,7 @@ dds_entity_t dds_get_subscriber (dds_entity_t entity) } } -dds_return_t dds__reader_data_allocator_init (const dds_reader *rd, dds_data_allocator_t *data_allocator) +dds_return_t dds__reader_data_allocator_init (const struct dds_reader *rd, dds_data_allocator_t *data_allocator) { #ifdef DDS_HAS_SHM dds_iox_allocator_t *d = (dds_iox_allocator_t *) data_allocator->opaque.bytes; @@ -843,7 +843,7 @@ dds_return_t dds__reader_data_allocator_init (const dds_reader *rd, dds_data_all #endif } -dds_return_t dds__reader_data_allocator_fini (const dds_reader *rd, dds_data_allocator_t *data_allocator) +dds_return_t dds__reader_data_allocator_fini (const struct dds_reader *rd, dds_data_allocator_t *data_allocator) { #ifdef DDS_HAS_SHM dds_iox_allocator_t *d = (dds_iox_allocator_t *) data_allocator->opaque.bytes; diff --git a/src/core/ddsc/src/dds_topic.c b/src/core/ddsc/src/dds_topic.c index 6156eced7c..50712f7a18 100644 --- a/src/core/ddsc/src/dds_topic.c +++ b/src/core/ddsc/src/dds_topic.c @@ -603,13 +603,13 @@ dds_entity_t dds_create_topic_sertype (dds_entity_t participant, const char *nam return dds_create_topic_impl (participant, name, false, sertype, qos, listener, false); } -dds_entity_t dds_create_topic (dds_entity_t participant, const dds_topic_descriptor_t *desc, const char *name, const dds_qos_t *qos, const dds_listener_t *listener) +dds_entity_t dds_create_topic (dds_entity_t participant, const dds_topic_descriptor_t *descriptor, const char *name, const dds_qos_t *qos, const dds_listener_t *listener) { dds_entity_t hdl; struct dds_entity *ppent; dds_return_t ret; - if (desc == NULL || name == NULL) + if (descriptor == NULL || name == NULL) return DDS_RETCODE_BAD_PARAMETER; if ((ret = dds_entity_pin (participant, &ppent)) < 0) @@ -625,9 +625,9 @@ dds_entity_t dds_create_topic (dds_entity_t participant, const dds_topic_descrip is required and the only valid value for this QoS. If the data representation is not set in the QoS (or no QoS object provided), the allowed data representations are added to the QoS object. */ - uint32_t allowed_repr = desc->m_flagset & DDS_TOPIC_RESTRICT_DATA_REPRESENTATION ? - desc->restrict_data_representation : DDS_DATA_REPRESENTATION_RESTRICT_DEFAULT; - uint16_t min_xcdrv = dds_stream_minimum_xcdr_version (desc->m_ops); + uint32_t allowed_repr = descriptor->m_flagset & DDS_TOPIC_RESTRICT_DATA_REPRESENTATION ? + descriptor->restrict_data_representation : DDS_DATA_REPRESENTATION_RESTRICT_DEFAULT; + uint16_t min_xcdrv = dds_stream_minimum_xcdr_version (descriptor->m_ops); if (min_xcdrv == DDSI_RTPS_CDR_ENC_VERSION_2) allowed_repr &= ~DDS_DATA_REPRESENTATION_FLAG_XCDR1; if ((hdl = dds_ensure_valid_data_representation (tpqos, allowed_repr, true)) != 0) @@ -637,7 +637,7 @@ dds_entity_t dds_create_topic (dds_entity_t participant, const dds_topic_descrip dds_data_representation_id_t data_representation = tpqos->data_representation.value.ids[0]; struct dds_sertype_default *st = ddsrt_malloc (sizeof (*st)); - if ((hdl = dds_sertype_default_init (ppent->m_domain, st, desc, min_xcdrv, data_representation)) < 0) + if ((hdl = dds_sertype_default_init (ppent->m_domain, st, descriptor, min_xcdrv, data_representation)) < 0) { ddsrt_free (st); goto err_st_init; diff --git a/src/core/ddsc/src/dds_waitset.c b/src/core/ddsc/src/dds_waitset.c index c35acb457f..2857dbe4d1 100644 --- a/src/core/ddsc/src/dds_waitset.c +++ b/src/core/ddsc/src/dds_waitset.c @@ -142,7 +142,7 @@ const struct dds_entity_deriver dds_entity_deriver_waitset = { .refresh_statistics = dds_entity_deriver_dummy_refresh_statistics }; -dds_entity_t dds_create_waitset (dds_entity_t owner) +dds_entity_t dds_create_waitset (dds_entity_t participant) { dds_entity *e; dds_return_t rc; @@ -154,7 +154,7 @@ dds_entity_t dds_create_waitset (dds_entity_t owner) if ((rc = dds_init ()) < 0) return rc; - if ((rc = dds_entity_lock (owner, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK) + if ((rc = dds_entity_lock (participant, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK) goto err_entity_lock; switch (dds_entity_kind (e)) diff --git a/src/core/ddsc/src/dds_whc.c b/src/core/ddsc/src/dds_whc.c index 8549e7f172..bc62d2e848 100644 --- a/src/core/ddsc/src/dds_whc.c +++ b/src/core/ddsc/src/dds_whc.c @@ -151,17 +151,17 @@ static void free_deferred_free_list (struct dds_whc_default_node *deferred_free_ static void get_state_locked (const struct whc_impl *whc, struct ddsi_whc_state *st); static uint32_t whc_default_remove_acked_messages_full (struct whc_impl *whc, ddsi_seqno_t max_drop_seq, struct ddsi_whc_node **deferred_free_list); -static uint32_t whc_default_remove_acked_messages (struct ddsi_whc *whc, ddsi_seqno_t max_drop_seq, struct ddsi_whc_state *whcst, struct ddsi_whc_node **deferred_free_list); -static void whc_default_free_deferred_free_list (struct ddsi_whc *whc, struct ddsi_whc_node *deferred_free_list); -static void whc_default_get_state (const struct ddsi_whc *whc, struct ddsi_whc_state *st); -static int whc_default_insert (struct ddsi_whc *whc, ddsi_seqno_t max_drop_seq, ddsi_seqno_t seq, ddsrt_mtime_t exp, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk); -static ddsi_seqno_t whc_default_next_seq (const struct ddsi_whc *whc, ddsi_seqno_t seq); -static bool whc_default_borrow_sample (const struct ddsi_whc *whc, ddsi_seqno_t seq, struct ddsi_whc_borrowed_sample *sample); -static bool whc_default_borrow_sample_key (const struct ddsi_whc *whc, const struct ddsi_serdata *serdata_key, struct ddsi_whc_borrowed_sample *sample); -static void whc_default_return_sample (struct ddsi_whc *whc, struct ddsi_whc_borrowed_sample *sample, bool update_retransmit_info); -static void whc_default_sample_iter_init (const struct ddsi_whc *whc, struct ddsi_whc_sample_iter *opaque_it); +static uint32_t whc_default_remove_acked_messages (struct ddsi_whc *whc_generic, ddsi_seqno_t max_drop_seq, struct ddsi_whc_state *whcst, struct ddsi_whc_node **deferred_free_list); +static void whc_default_free_deferred_free_list (struct ddsi_whc *whc_generic, struct ddsi_whc_node *deferred_free_list); +static void whc_default_get_state (const struct ddsi_whc *whc_generic, struct ddsi_whc_state *st); +static int whc_default_insert (struct ddsi_whc *whc_generic, ddsi_seqno_t max_drop_seq, ddsi_seqno_t seq, ddsrt_mtime_t exp, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk); +static ddsi_seqno_t whc_default_next_seq (const struct ddsi_whc *whc_generic, ddsi_seqno_t seq); +static bool whc_default_borrow_sample (const struct ddsi_whc *whc_generic, ddsi_seqno_t seq, struct ddsi_whc_borrowed_sample *sample); +static bool whc_default_borrow_sample_key (const struct ddsi_whc *whc_generic, const struct ddsi_serdata *serdata_key, struct ddsi_whc_borrowed_sample *sample); +static void whc_default_return_sample (struct ddsi_whc *whc_generic, struct ddsi_whc_borrowed_sample *sample, bool update_retransmit_info); +static void whc_default_sample_iter_init (const struct ddsi_whc *whc_generic, struct ddsi_whc_sample_iter *opaque_it); static bool whc_default_sample_iter_borrow_next (struct ddsi_whc_sample_iter *opaque_it, struct ddsi_whc_borrowed_sample *sample); -static void whc_default_free (struct ddsi_whc *whc); +static void whc_default_free (struct ddsi_whc *whc_generic); static const ddsrt_avl_treedef_t whc_seq_treedef = DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct whc_intvnode, avlnode), offsetof (struct whc_intvnode, min), compare_seq, 0); diff --git a/src/core/ddsc/src/dds_write.c b/src/core/ddsc/src/dds_write.c index f065b6bb23..053880a457 100644 --- a/src/core/ddsc/src/dds_write.c +++ b/src/core/ddsc/src/dds_write.c @@ -578,9 +578,9 @@ dds_return_t dds_write_impl (dds_writer *wr, const void * data, dds_time_t tstam return ret; } -dds_return_t dds_writecdr_impl (dds_writer *wr, struct ddsi_xpack *xp, struct ddsi_serdata *dinp, bool flush) +dds_return_t dds_writecdr_impl (dds_writer *wr, struct ddsi_xpack *xp, struct ddsi_serdata *d, bool flush) { - return dds_writecdr_impl_common (wr->m_wr, xp, (struct ddsi_serdata_any *) dinp, flush, wr); + return dds_writecdr_impl_common (wr->m_wr, xp, (struct ddsi_serdata_any *) d, flush, wr); } void dds_write_flush_impl (dds_writer *wr) diff --git a/src/ddsrt/include/dds/ddsrt/avl.h b/src/ddsrt/include/dds/ddsrt/avl.h index 4f6a97607e..aa0daa779d 100644 --- a/src/ddsrt/include/dds/ddsrt/avl.h +++ b/src/ddsrt/include/dds/ddsrt/avl.h @@ -195,17 +195,17 @@ typedef int (*ddsrt_avl_compare_r_t) (const void *a, const void *b, void *arg); * It is intended to update user data in nodes when a change occurs in one or both child nodes, * or when a the change occurs in the node itself. */ -typedef void (*ddsrt_avl_augment_t) (void *node, const void *left, const void *right); +typedef void (*ddsrt_avl_augment_t) (void *vnode, const void *left, const void *right); /** * @brief User defined walk function to perform an action on each node in the tree. */ -typedef void (*ddsrt_avl_walk_t) (void *node, void *arg); +typedef void (*ddsrt_avl_walk_t) (void *vnode, void *arg); /** * @brief Like @ref ddsrt_avl_walk_t, but works on const nodes. */ -typedef void (*ddsrt_avl_const_walk_t) (const void *node, void *arg); +typedef void (*ddsrt_avl_const_walk_t) (const void *vnode, void *arg); /// @brief The avl node is the basic element of the avl tree structure. /// @@ -445,7 +445,7 @@ DDS_EXPORT void ddsrt_avl_init (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t * @param[in] freefun optional user defined free function to use on nodes, NULL if not used * @see ddsrt_avl_init */ -DDS_EXPORT void ddsrt_avl_free (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *node)) ddsrt_nonnull((1,2)); +DDS_EXPORT void ddsrt_avl_free (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *vnode)) ddsrt_nonnull((1,2)); /** * @brief Same as @ref ddsrt_avl_free, but with an extra argument for the free function. @@ -453,7 +453,7 @@ DDS_EXPORT void ddsrt_avl_free (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t * Extra parameter: * @param[in] arg is for the user defined free function */ -DDS_EXPORT void ddsrt_avl_free_arg (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *node, void *arg), void *arg) ddsrt_nonnull((1,2)); +DDS_EXPORT void ddsrt_avl_free_arg (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *vnode, void *arg), void *arg) ddsrt_nonnull((1,2)); /** * @brief Get the root node @@ -553,10 +553,10 @@ DDS_EXPORT void *ddsrt_avl_lookup_succ (const ddsrt_avl_treedef_t *td, const dds * * @param[in] td treedef of the tree * @param[in,out] tree the avl tree - * @param[in] node the node to insert + * @param[in] vnode the node to insert * @see ddsrt_avl_delete */ -DDS_EXPORT void ddsrt_avl_insert (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_insert (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *vnode) ddsrt_nonnull_all; /** * @brief Remove a node from the tree. @@ -567,10 +567,10 @@ DDS_EXPORT void ddsrt_avl_insert (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_ * * @param[in] td treedef of the tree * @param[in,out] tree the avl tree - * @param[in] node the node to remove + * @param[in] vnode the node to remove * @see ddsrt_avl_insert */ -DDS_EXPORT void ddsrt_avl_delete (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_delete (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *vnode) ddsrt_nonnull_all; /** * @brief Same as @ref ddsrt_avl_insert, but also requires a @ref ddsrt_avl_ipath. @@ -579,11 +579,11 @@ DDS_EXPORT void ddsrt_avl_delete (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_ * * @param[in] td treedef of the tree * @param[in,out] tree the avl tree - * @param[in] node the node to insert + * @param[in] vnode the node to insert * @param[in] path is the insert path * @see ddsrt_avl_delete_dpath */ -DDS_EXPORT void ddsrt_avl_insert_ipath (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *node, ddsrt_avl_ipath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_insert_ipath (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *vnode, ddsrt_avl_ipath_t *path) ddsrt_nonnull_all; /** * @brief Same as @ref ddsrt_avl_delete, but also requires a @ref ddsrt_avl_dpath. @@ -592,11 +592,11 @@ DDS_EXPORT void ddsrt_avl_insert_ipath (const ddsrt_avl_treedef_t *td, ddsrt_avl * * @param[in] td treedef of the tree * @param[in,out] tree the avl tree - * @param[in] node the node to remove + * @param[in] vnode the node to remove * @param[in] path is the delete path * @see ddsrt_avl_insert_ipath */ -DDS_EXPORT void ddsrt_avl_delete_dpath (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *node, ddsrt_avl_dpath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_delete_dpath (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *vnode, ddsrt_avl_dpath_t *path) ddsrt_nonnull_all; /** * @brief Replace a node in the tree. @@ -606,12 +606,12 @@ DDS_EXPORT void ddsrt_avl_delete_dpath (const ddsrt_avl_treedef_t *td, ddsrt_avl * * @param[in] td treedef of the tree * @param[in,out] tree the avl tree - * @param[in] oldn the node to replace - * @param[in] newn the node to take the old node's place + * @param[in] voldn the node to replace + * @param[in] vnewn the node to take the old node's place * @see ddsrt_avl_insert * @see ddsrt_avl_delete */ -DDS_EXPORT void ddsrt_avl_swap_node (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *oldn, void *newn) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_swap_node (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *voldn, void *vnewn) ddsrt_nonnull_all; /** * @brief Call the user defined augment function @ref ddsrt_avl_augment_t on a node and its parents up to the root. @@ -621,9 +621,9 @@ DDS_EXPORT void ddsrt_avl_swap_node (const ddsrt_avl_treedef_t *td, ddsrt_avl_tr * It is called for each node on the path to (and inclusive of) the root. * * @param[in] td treedef of the tree - * @param[in] node is the node from which to start the augmentation + * @param[in] vnode is the node from which to start the augmentation */ -DDS_EXPORT void ddsrt_avl_augment_update (const ddsrt_avl_treedef_t *td, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_augment_update (const ddsrt_avl_treedef_t *td, void *vnode) ddsrt_nonnull_all; /** * @brief Check whether the tree is empty or not. @@ -828,10 +828,10 @@ DDS_EXPORT void ddsrt_avl_ctreedef_init_r (ddsrt_avl_ctreedef_t *td, size_t avln DDS_EXPORT void ddsrt_avl_cinit (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; /** @brief Counted version of @ref ddsrt_avl_free*/ -DDS_EXPORT void ddsrt_avl_cfree (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *node)) ddsrt_nonnull((1,2)); +DDS_EXPORT void ddsrt_avl_cfree (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *vnode)) ddsrt_nonnull((1,2)); /** @brief Counted version of @ref ddsrt_avl_free_arg*/ -DDS_EXPORT void ddsrt_avl_cfree_arg (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *node, void *arg), void *arg) ddsrt_nonnull((1,2)); +DDS_EXPORT void ddsrt_avl_cfree_arg (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *vnode, void *arg), void *arg) ddsrt_nonnull((1,2)); /** @brief Counted version of @ref ddsrt_avl_root*/ DDS_EXPORT void *ddsrt_avl_croot (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; @@ -861,22 +861,22 @@ DDS_EXPORT void *ddsrt_avl_clookup_pred (const ddsrt_avl_ctreedef_t *td, const d DDS_EXPORT void *ddsrt_avl_clookup_succ (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *key) ddsrt_nonnull_all; /** @brief Counted version of @ref ddsrt_avl_insert*/ -DDS_EXPORT void ddsrt_avl_cinsert (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cinsert (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *vnode) ddsrt_nonnull_all; /** @brief Counted version of @ref ddsrt_avl_delete*/ -DDS_EXPORT void ddsrt_avl_cdelete (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cdelete (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *vnode) ddsrt_nonnull_all; /** @brief Counted version of @ref ddsrt_avl_insert_ipath*/ -DDS_EXPORT void ddsrt_avl_cinsert_ipath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node, ddsrt_avl_ipath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cinsert_ipath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *vnode, ddsrt_avl_ipath_t *path) ddsrt_nonnull_all; /** @brief Counted version of @ref ddsrt_avl_delete_dpath*/ -DDS_EXPORT void ddsrt_avl_cdelete_dpath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node, ddsrt_avl_dpath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cdelete_dpath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *vnode, ddsrt_avl_dpath_t *path) ddsrt_nonnull_all; /** @brief Counted version of @ref ddsrt_avl_swap_node*/ -DDS_EXPORT void ddsrt_avl_cswap_node (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *oldn, void *newn) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cswap_node (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *voldn, void *vnewn) ddsrt_nonnull_all; /** @brief Counted version of @ref ddsrt_avl_augment_update*/ -DDS_EXPORT void ddsrt_avl_caugment_update (const ddsrt_avl_ctreedef_t *td, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_caugment_update (const ddsrt_avl_ctreedef_t *td, void *vnode) ddsrt_nonnull_all; /** @brief Counted version of @ref ddsrt_avl_is_empty*/ DDS_EXPORT int ddsrt_avl_cis_empty (const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; diff --git a/src/ddsrt/include/dds/ddsrt/log.h b/src/ddsrt/include/dds/ddsrt/log.h index b8d0fba56b..aa8df26683 100644 --- a/src/ddsrt/include/dds/ddsrt/log.h +++ b/src/ddsrt/include/dds/ddsrt/log.h @@ -261,7 +261,7 @@ dds_log_cfg_init( void dds_log_cfg( const struct ddsrt_log_cfg *cfg, - uint32_t prio, + uint32_t cat, const char *file, uint32_t line, const char *func, @@ -280,7 +280,7 @@ dds_log_cfg( */ void dds_log_id( - uint32_t prio, + uint32_t cat, uint32_t domid, const char *file, uint32_t line, @@ -299,7 +299,7 @@ dds_log_id( */ DDS_EXPORT void dds_log( - uint32_t prio, + uint32_t cat, const char *file, uint32_t line, const char *func, diff --git a/src/ddsrt/src/avl.c b/src/ddsrt/src/avl.c index cb6a7dbdfd..5fe3616bbe 100644 --- a/src/ddsrt/src/avl.c +++ b/src/ddsrt/src/avl.c @@ -170,7 +170,7 @@ static void treedestroy_arg (const ddsrt_avl_treedef_t *td, ddsrt_avl_node_t *n, } } -void ddsrt_avl_free (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *node)) +void ddsrt_avl_free (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *vnode)) { ddsrt_avl_node_t *n = tree->root; tree->root = NULL; @@ -179,7 +179,7 @@ void ddsrt_avl_free (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void } } -void ddsrt_avl_free_arg (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *node, void *arg), void *arg) +void ddsrt_avl_free_arg (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *vnode, void *arg), void *arg) { ddsrt_avl_node_t *n = tree->root; tree->root = NULL; @@ -549,10 +549,10 @@ void ddsrt_avl_delete (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, vo delete_generic (td, tree, vnode, NULL); } -void ddsrt_avl_swap_node (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *vold, void *vnew) +void ddsrt_avl_swap_node (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *voldn, void *vnewn) { - ddsrt_avl_node_t *old = node_from_onode_nonnull (td, vold); - ddsrt_avl_node_t *new = node_from_onode_nonnull (td, vnew); + ddsrt_avl_node_t *old = node_from_onode_nonnull (td, voldn); + ddsrt_avl_node_t *new = node_from_onode_nonnull (td, vnewn); *nodeptr_from_node (tree, old) = new; /* use memmove so partially overlap between old & new is allowed (yikes!, but exploited by the memory allocator, and not a big @@ -1007,13 +1007,13 @@ void ddsrt_avl_cinit (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree) tree->count = 0; } -void ddsrt_avl_cfree (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *node)) +void ddsrt_avl_cfree (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *vnode)) { tree->count = 0; ddsrt_avl_free (&td->t, &tree->t, freefun); } -void ddsrt_avl_cfree_arg (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *node, void *arg), void *arg) +void ddsrt_avl_cfree_arg (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *vnode, void *arg), void *arg) { tree->count = 0; ddsrt_avl_free_arg (&td->t, &tree->t, freefun, arg); @@ -1064,40 +1064,40 @@ void *ddsrt_avl_clookup_succ (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ct return ddsrt_avl_lookup_succ (&td->t, &tree->t, key); } -void ddsrt_avl_cinsert (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node) +void ddsrt_avl_cinsert (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *vnode) { tree->count++; - ddsrt_avl_insert (&td->t, &tree->t, node); + ddsrt_avl_insert (&td->t, &tree->t, vnode); } -void ddsrt_avl_cdelete (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node) +void ddsrt_avl_cdelete (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *vnode) { assert (tree->count > 0); tree->count--; - ddsrt_avl_delete (&td->t, &tree->t, node); + ddsrt_avl_delete (&td->t, &tree->t, vnode); } -void ddsrt_avl_cinsert_ipath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node, ddsrt_avl_ipath_t *path) +void ddsrt_avl_cinsert_ipath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *vnode, ddsrt_avl_ipath_t *path) { tree->count++; - ddsrt_avl_insert_ipath (&td->t, &tree->t, node, path); + ddsrt_avl_insert_ipath (&td->t, &tree->t, vnode, path); } -void ddsrt_avl_cdelete_dpath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node, ddsrt_avl_dpath_t *path) +void ddsrt_avl_cdelete_dpath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *vnode, ddsrt_avl_dpath_t *path) { assert (tree->count > 0); tree->count--; - ddsrt_avl_delete_dpath (&td->t, &tree->t, node, path); + ddsrt_avl_delete_dpath (&td->t, &tree->t, vnode, path); } -void ddsrt_avl_cswap_node (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *old, void *new) +void ddsrt_avl_cswap_node (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *voldn, void *vnewn) { - ddsrt_avl_swap_node (&td->t, &tree->t, old, new); + ddsrt_avl_swap_node (&td->t, &tree->t, voldn, vnewn); } -void ddsrt_avl_caugment_update (const ddsrt_avl_ctreedef_t *td, void *node) +void ddsrt_avl_caugment_update (const ddsrt_avl_ctreedef_t *td, void *vnode) { - ddsrt_avl_augment_update (&td->t, node); + ddsrt_avl_augment_update (&td->t, vnode); } int ddsrt_avl_cis_empty (const ddsrt_avl_ctree_t *tree) diff --git a/src/ddsrt/src/environ.c b/src/ddsrt/src/environ.c index 116e164caf..df77fc74b4 100644 --- a/src/ddsrt/src/environ.c +++ b/src/ddsrt/src/environ.c @@ -44,15 +44,15 @@ static const char * expand_lookup_env(const char *name, void * data) return env; } -char *ddsrt_expand_envvars_sh (const char *src0, uint32_t domid) +char *ddsrt_expand_envvars_sh (const char *string, uint32_t domid) { struct expand_env_data env = { .domid = domid, .idstr = "" }; - return ddsrt_expand_vars_sh(src0, &expand_lookup_env, &env); + return ddsrt_expand_vars_sh(string, &expand_lookup_env, &env); } -char *ddsrt_expand_envvars (const char *src0, uint32_t domid) +char *ddsrt_expand_envvars (const char *string, uint32_t domid) { struct expand_env_data env = { .domid = domid, .idstr = "" }; - return ddsrt_expand_vars(src0, &expand_lookup_env, &env); + return ddsrt_expand_vars(string, &expand_lookup_env, &env); } diff --git a/src/ddsrt/src/expand_vars.c b/src/ddsrt/src/expand_vars.c index d44e3654c9..a2e5df039f 100644 --- a/src/ddsrt/src/expand_vars.c +++ b/src/ddsrt/src/expand_vars.c @@ -289,13 +289,13 @@ static char *ddsrt_expand_vars1 (const char *src0, expand_lookup_fn lookup, void return NULL; } -char *ddsrt_expand_vars_sh (const char *src0, expand_lookup_fn lookup, void * data) +char *ddsrt_expand_vars_sh (const char *string, expand_lookup_fn lookup, void * data) { - return ddsrt_expand_vars_sh1 (src0, lookup, data, 0); + return ddsrt_expand_vars_sh1 (string, lookup, data, 0); } -char *ddsrt_expand_vars (const char *src0, expand_lookup_fn lookup, void * data) +char *ddsrt_expand_vars (const char *string, expand_lookup_fn lookup, void * data) { - return ddsrt_expand_vars1 (src0, lookup, data, 0); + return ddsrt_expand_vars1 (string, lookup, data, 0); } diff --git a/src/ddsrt/src/log.c b/src/ddsrt/src/log.c index ce924b2ced..5fb8afb727 100644 --- a/src/ddsrt/src/log.c +++ b/src/ddsrt/src/log.c @@ -315,12 +315,12 @@ void dds_log_cfg (const struct ddsrt_log_cfg *cfg, uint32_t cat, const char *fil } } -void dds_log_id (uint32_t cat, uint32_t id, const char *file, uint32_t line, const char *func, const char *fmt, ...) +void dds_log_id (uint32_t cat, uint32_t domid, const char *file, uint32_t line, const char *func, const char *fmt, ...) { if (dds_get_log_mask () & cat) { va_list ap; va_start (ap, fmt); - vlog (&logconfig, cat, id, file, line, func, fmt, ap); + vlog (&logconfig, cat, domid, file, line, func, fmt, ap); va_end (ap); } } diff --git a/src/ddsrt/src/retcode.c b/src/ddsrt/src/retcode.c index d120b4f3dc..0efc1e4c25 100644 --- a/src/ddsrt/src/retcode.c +++ b/src/ddsrt/src/retcode.c @@ -42,7 +42,7 @@ static const char *xretcodes[] = { "Not found" }; -const char *dds_strretcode (dds_return_t rc) +const char *dds_strretcode (dds_return_t ret) { const dds_return_t nretcodes = (dds_return_t) (sizeof (retcodes) / sizeof (retcodes[0])); const dds_return_t nxretcodes = (dds_return_t) (sizeof (xretcodes) / sizeof (xretcodes[0])); @@ -52,15 +52,15 @@ const char *dds_strretcode (dds_return_t rc) is called with a -N for N a API return value, so ... play it safe and use the magnitude. Specially handle INT32_MIN to avoid undefined behaviour on integer overflow. */ - if (rc == INT32_MIN) + if (ret == INT32_MIN) return xretcodes[0]; - if (rc < 0) - rc = -rc; - if (rc >= 0 && rc < nretcodes) - return retcodes[rc]; - else if (rc >= (-DDS_XRETCODE_BASE) && rc < (-DDS_XRETCODE_BASE) + nxretcodes) - return xretcodes[rc - (-DDS_XRETCODE_BASE)]; + if (ret < 0) + ret = -ret; + if (ret >= 0 && ret < nretcodes) + return retcodes[ret]; + else if (ret >= (-DDS_XRETCODE_BASE) && ret < (-DDS_XRETCODE_BASE) + nxretcodes) + return xretcodes[ret - (-DDS_XRETCODE_BASE)]; else return xretcodes[0]; } diff --git a/src/ddsrt/src/sockets/posix/gethostname.c b/src/ddsrt/src/sockets/posix/gethostname.c index 1393ccc795..2a07acac08 100644 --- a/src/ddsrt/src/sockets/posix/gethostname.c +++ b/src/ddsrt/src/sockets/posix/gethostname.c @@ -38,8 +38,8 @@ dds_return_t ddsrt_gethostname( - char *name, - size_t len) + char *hostname, + size_t buffersize) { char buf[HOST_NAME_MAX + 1 /* '\0' */]; @@ -49,7 +49,7 @@ ddsrt_gethostname( /* If truncation occurrs, no error is returned whether or not the buffer is null-terminated. */ if (buf[HOST_NAME_MAX - 1] != '\0' || - ddsrt_strlcpy(name, buf, len) >= len) + ddsrt_strlcpy(hostname, buf, buffersize) >= buffersize) { return DDS_RETCODE_NOT_ENOUGH_SPACE; } diff --git a/src/ddsrt/src/sockets/windows/gethostname.c b/src/ddsrt/src/sockets/windows/gethostname.c index d41e24e3e5..24ab3cca8e 100644 --- a/src/ddsrt/src/sockets/windows/gethostname.c +++ b/src/ddsrt/src/sockets/windows/gethostname.c @@ -15,15 +15,15 @@ dds_return_t ddsrt_gethostname( - char *name, - size_t len) + char *hostname, + size_t buffersize) { - assert(name != NULL); - assert(len <= INT_MAX); + assert(hostname != NULL); + assert(buffersize <= INT_MAX); - if (len == 0) { + if (buffersize == 0) { return DDS_RETCODE_BAD_PARAMETER; - } else if (gethostname(name, (int)len) == 0) { + } else if (gethostname(hostname, (int)buffersize) == 0) { return DDS_RETCODE_OK; } diff --git a/src/ddsrt/src/string.c b/src/ddsrt/src/string.c index f99c765429..f632a859b0 100644 --- a/src/ddsrt/src/string.c +++ b/src/ddsrt/src/string.c @@ -64,18 +64,18 @@ ddsrt_strncasecmp( } char * -ddsrt_strsep(char **str, const char *sep) +ddsrt_strsep(char **stringp, const char *delim) { char *ret; - if (**str == '\0') + if (**stringp == '\0') return 0; - ret = *str; - while (**str && strchr (sep, **str) == 0) - (*str)++; - if (**str != '\0') + ret = *stringp; + while (**stringp && strchr (delim, **stringp) == 0) + (*stringp)++; + if (**stringp != '\0') { - **str = '\0'; - (*str)++; + **stringp = '\0'; + (*stringp)++; } return ret; } @@ -144,12 +144,12 @@ ddsrt_strlcat( } void * -ddsrt_memdup(const void *src, size_t n) +ddsrt_memdup(const void *ptr, size_t len) { void *dest = NULL; - if (n != 0 && (dest = ddsrt_malloc_s(n)) != NULL) { - memcpy(dest, src, n); + if (len != 0 && (dest = ddsrt_malloc_s(len)) != NULL) { + memcpy(dest, ptr, len); } return dest; diff --git a/src/ddsrt/src/threads.c b/src/ddsrt/src/threads.c index e481c0b2ce..902ba8676f 100644 --- a/src/ddsrt/src/threads.c +++ b/src/ddsrt/src/threads.c @@ -14,10 +14,10 @@ void ddsrt_threadattr_init ( - ddsrt_threadattr_t *tattr) + ddsrt_threadattr_t *attr) { - assert(tattr != NULL); - tattr->schedClass = DDSRT_SCHED_DEFAULT; - tattr->schedPriority = 0; - tattr->stackSize = 0; + assert(attr != NULL); + attr->schedClass = DDSRT_SCHED_DEFAULT; + attr->schedPriority = 0; + attr->stackSize = 0; } diff --git a/src/ddsrt/src/threads/posix/threads.c b/src/ddsrt/src/threads/posix/threads.c index 9ec9a3c043..352e16222a 100644 --- a/src/ddsrt/src/threads/posix/threads.c +++ b/src/ddsrt/src/threads/posix/threads.c @@ -77,14 +77,14 @@ int _open(const char *name, int mode) { return -1; } #endif size_t -ddsrt_thread_getname(char *str, size_t size) +ddsrt_thread_getname(char * __restrict name, size_t size) { #ifdef MAXTHREADNAMESIZE char buf[MAXTHREADNAMESIZE + 1] = ""; #endif size_t cnt = 0; - assert(str != NULL); + assert(name != NULL); assert(size > 0); #if defined(__linux) @@ -92,23 +92,23 @@ ddsrt_thread_getname(char *str, size_t size) allow space for. prctl is favored over pthread_getname_np for portability. e.g. musl libc. */ (void)prctl(PR_GET_NAME, (unsigned long)buf, 0UL, 0UL, 0UL); - cnt = ddsrt_strlcpy(str, buf, size); + cnt = ddsrt_strlcpy(name, buf, size); #elif defined(__APPLE__) /* pthread_getname_np on APPLE uses strlcpy to copy the thread name, but does not return the number of bytes (that would have been) written. Use an intermediate buffer. */ (void)pthread_getname_np(pthread_self(), buf, sizeof(buf)); - cnt = ddsrt_strlcpy(str, buf, size); + cnt = ddsrt_strlcpy(name, buf, size); #elif defined(__FreeBSD__) (void)pthread_get_name_np(pthread_self(), buf, sizeof(buf)); - cnt = ddsrt_strlcpy(str, buf, size); + cnt = ddsrt_strlcpy(name, buf, size); #elif defined(__sun) #if !(__SunOS_5_6 || __SunOS_5_7 || __SunOS_5_8 || __SunOS_5_9 || __SunOS_5_10) (void)pthread_getname_np(pthread_self(), buf, sizeof(buf)); #else buf[0] = 0; #endif - cnt = ddsrt_strlcpy(str, buf, size); + cnt = ddsrt_strlcpy(name, buf, size); #elif defined(__VXWORKS__) { char *ptr; @@ -120,21 +120,21 @@ ddsrt_thread_getname(char *str, size_t size) if (ptr == NULL) { ptr = buf; } - cnt = ddsrt_strlcpy(str, ptr, size); + cnt = ddsrt_strlcpy(name, ptr, size); } #elif defined(__QNXNTO__) (void)pthread_getname_np(pthread_self(), buf, sizeof(buf)); - cnt = ddsrt_strlcpy(str, buf, size); + cnt = ddsrt_strlcpy(name, buf, size); #elif defined(__ZEPHYR__) && defined(CONFIG_THREAD_NAME) (void)pthread_getname_np(pthread_self(), buf, sizeof(buf)); - cnt = ddsrt_strlcpy(str, buf, size); + cnt = ddsrt_strlcpy(name, buf, size); #endif /* Thread identifier is used as fall back if thread name lookup is not supported or the thread name is empty. */ if (cnt == 0) { ddsrt_tid_t tid = ddsrt_gettid(); - cnt = (size_t)snprintf(str, size, "%"PRIdTID, tid); + cnt = (size_t)snprintf(name, size, "%"PRIdTID, tid); } return cnt; @@ -246,13 +246,13 @@ K_THREAD_STACK_ARRAY_DEFINE(zephyr_stacks, CYCLONEDDS_THREAD_COUNT, CYCLONEDDS_T dds_return_t ddsrt_thread_create ( - ddsrt_thread_t *threadptr, + ddsrt_thread_t *thread, const char *name, - const ddsrt_threadattr_t *threadAttr, - uint32_t (*start_routine) (void *), + const ddsrt_threadattr_t *attr, + ddsrt_thread_routine_t start_routine, void *arg) { - pthread_attr_t attr; + pthread_attr_t pattr; thread_context_t *ctx; ddsrt_threadattr_t tattr; int result, create_ret; @@ -260,11 +260,11 @@ ddsrt_thread_create ( sigset_t set, oset; #endif - assert (threadptr != NULL); + assert (thread != NULL); assert (name != NULL); - assert (threadAttr != NULL); + assert (attr != NULL); assert (start_routine != NULL); - tattr = *threadAttr; + tattr = *attr; #if defined(__ZEPHYR__) /* Override requested size by size of statically allocated stacks */ @@ -277,21 +277,21 @@ ddsrt_thread_create ( } #endif - if (pthread_attr_init (&attr) != 0) + if (pthread_attr_init (&pattr) != 0) return DDS_RETCODE_ERROR; #if defined(__VXWORKS__) /* pthread_setname_np is not available on VxWorks. Use pthread_attr_setname instead (proprietary VxWorks extension). */ - (void)pthread_attr_setname (&attr, name); + (void)pthread_attr_setname (&pattr, name); #endif #if !defined(__ZEPHYR__) - if (pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM) != 0) + if (pthread_attr_setscope (&pattr, PTHREAD_SCOPE_SYSTEM) != 0) goto err; #endif - if (pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_JOINABLE) != 0) { + if (pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE) != 0) { goto err; } @@ -303,7 +303,7 @@ ddsrt_thread_create ( #endif #if !defined(__ZEPHYR__) - if ((result = pthread_attr_setstacksize (&attr, tattr.stackSize)) != 0) + if ((result = pthread_attr_setstacksize (&pattr, tattr.stackSize)) != 0) { DDS_ERROR ("ddsrt_thread_create(%s): pthread_attr_setstacksize(%"PRIu32") failed with error %d\n", name, tattr.stackSize, result); goto err; @@ -369,20 +369,20 @@ ddsrt_thread_create ( break; } if (tattr.schedClass != DDSRT_SCHED_DEFAULT) { - if ((result = pthread_attr_setschedpolicy (&attr, policy)) != 0) + if ((result = pthread_attr_setschedpolicy (&pattr, policy)) != 0) { DDS_ERROR("ddsrt_thread_create(%s): pthread_attr_setschedpolicy(%d) failed with error %d\n", name, policy, result); goto err; } } sched_param.sched_priority = tattr.schedPriority; - if ((result = pthread_attr_setschedparam (&attr, &sched_param)) != 0) + if ((result = pthread_attr_setschedparam (&pattr, &sched_param)) != 0) { DDS_ERROR("ddsrt_thread_create(%s): pthread_attr_setschedparam(priority = %d) failed with error %d\n", name, tattr.schedPriority, result); goto err; } #if !defined(__ZEPHYR__) - if ((result = pthread_attr_setinheritsched (&attr, PTHREAD_EXPLICIT_SCHED)) != 0) + if ((result = pthread_attr_setinheritsched (&pattr, PTHREAD_EXPLICIT_SCHED)) != 0) { DDS_ERROR("ddsrt_thread_create(%s): pthread_attr_setinheritsched(EXPLICIT) failed with error %d\n", name, result); goto err; @@ -409,7 +409,7 @@ ddsrt_thread_create ( #endif sigprocmask (SIG_BLOCK, &set, &oset); #endif /* !defined(__ZEPHYR__) */ - if ((create_ret = pthread_create (&threadptr->v, &attr, os_startRoutineWrapper, ctx)) != 0) + if ((create_ret = pthread_create (&thread->v, &pattr, os_startRoutineWrapper, ctx)) != 0) { DDS_ERROR ("os_threadCreate(%s): pthread_create failed with error %d\n", name, create_ret); goto err_create; @@ -417,14 +417,14 @@ ddsrt_thread_create ( #if !defined(__ZEPHYR__) sigprocmask (SIG_SETMASK, &oset, NULL); #endif - pthread_attr_destroy (&attr); + pthread_attr_destroy (&pattr); return DDS_RETCODE_OK; err_create: ddsrt_free (ctx->name); ddsrt_free (ctx); err: - pthread_attr_destroy (&attr); + pthread_attr_destroy (&pattr); return DDS_RETCODE_ERROR; } @@ -466,9 +466,9 @@ ddsrt_thread_self(void) return id; } -bool ddsrt_thread_equal(ddsrt_thread_t a, ddsrt_thread_t b) +bool ddsrt_thread_equal(ddsrt_thread_t t1, ddsrt_thread_t t2) { - return (pthread_equal(a.v, b.v) != 0); + return (pthread_equal(t1.v, t2.v) != 0); } dds_return_t diff --git a/src/ddsrt/src/time.c b/src/ddsrt/src/time.c index b85b6430b6..2a07ba8aa1 100644 --- a/src/ddsrt/src/time.c +++ b/src/ddsrt/src/time.c @@ -23,13 +23,13 @@ DDS_EXPORT extern inline ddsrt_etime_t ddsrt_etime_add_duration(ddsrt_etime_t ab #if !_WIN32 && !DDSRT_WITH_FREERTOS #include -void dds_sleepfor(dds_duration_t n) +void dds_sleepfor(dds_duration_t reltime) { struct timespec t, r; - if (n >= 0) { - t.tv_sec = (time_t) (n / DDS_NSECS_IN_SEC); - t.tv_nsec = (long) (n % DDS_NSECS_IN_SEC); + if (reltime >= 0) { + t.tv_sec = (time_t) (reltime / DDS_NSECS_IN_SEC); + t.tv_nsec = (long) (reltime % DDS_NSECS_IN_SEC); while (nanosleep(&t, &r) == -1 && errno == EINTR) { t = r; } @@ -38,7 +38,7 @@ void dds_sleepfor(dds_duration_t n) #endif size_t -ddsrt_ctime(dds_time_t n, char *str, size_t size) +ddsrt_ctime(dds_time_t abstime, char *str, size_t size) { struct tm tm; #if __SunOS_5_6 || __MINGW32__ @@ -49,7 +49,7 @@ ddsrt_ctime(dds_time_t n, char *str, size_t size) #endif char buf[] = "YYYY-mm-dd HH:MM:SS.hh:mm"; /* RFC 3339 */ size_t cnt; - time_t sec = (time_t)(n / DDS_NSECS_IN_SEC); + time_t sec = (time_t)(abstime / DDS_NSECS_IN_SEC); assert(str != NULL); From c0998c9c31b25cd465e4207af3db5f4f28ccc5b1 Mon Sep 17 00:00:00 2001 From: Splinter1984 Date: Wed, 28 Jun 2023 10:41:32 +0200 Subject: [PATCH 2/5] resolve unknown type error --- src/core/ddsc/include/dds/dds.h | 2 +- src/core/ddsc/src/dds_topic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ddsc/include/dds/dds.h b/src/core/ddsc/include/dds/dds.h index ee8d251197..7aa9eef603 100644 --- a/src/core/ddsc/include/dds/dds.h +++ b/src/core/ddsc/include/dds/dds.h @@ -1388,7 +1388,7 @@ dds_create_topic_sertype ( struct ddsi_sertype **sertype, const dds_qos_t *qos, const dds_listener_t *listener, - const ddsi_plist_t *sedp_plist); + const struct ddsi_plist *sedp_plist); /** * @brief Finds a locally created or discovered remote topic by topic name and type information diff --git a/src/core/ddsc/src/dds_topic.c b/src/core/ddsc/src/dds_topic.c index a7f6cf21f1..dd854d4956 100644 --- a/src/core/ddsc/src/dds_topic.c +++ b/src/core/ddsc/src/dds_topic.c @@ -597,7 +597,7 @@ dds_entity_t dds_create_topic_impl ( return rc; } -dds_entity_t dds_create_topic_sertype (dds_entity_t participant, const char *name, struct ddsi_sertype **sertype, const dds_qos_t *qos, const dds_listener_t *listener, const ddsi_plist_t *sedp_plist) +dds_entity_t dds_create_topic_sertype (dds_entity_t participant, const char *name, struct ddsi_sertype **sertype, const dds_qos_t *qos, const dds_listener_t *listener, const struct ddsi_plist *sedp_plist) { (void) sedp_plist; return dds_create_topic_impl (participant, name, false, sertype, qos, listener, false); From cb459cdc45e2fce4bf709e444682e5b123e2f063 Mon Sep 17 00:00:00 2001 From: Splinter1984 Date: Wed, 28 Jun 2023 10:43:59 +0200 Subject: [PATCH 3/5] resolve ddsi_status_cb_data_t unknown type error --- src/core/ddsc/src/dds__reader.h | 2 +- src/core/ddsc/src/dds_reader.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ddsc/src/dds__reader.h b/src/core/ddsc/src/dds__reader.h index 5df36e61e1..575786b559 100644 --- a/src/core/ddsc/src/dds__reader.h +++ b/src/core/ddsc/src/dds__reader.h @@ -20,7 +20,7 @@ extern "C" { struct ddsi_status_cb_data; /** @component reader */ -void dds_reader_status_cb (void *entity, const ddsi_status_cb_data_t * data); +void dds_reader_status_cb (void *entity, const struct ddsi_status_cb_data * data); /** @component reader */ dds_return_t dds_return_reader_loan (dds_reader *rd, void **buf, int32_t bufsz); diff --git a/src/core/ddsc/src/dds_reader.c b/src/core/ddsc/src/dds_reader.c index 9d7b614459..be39b5054c 100644 --- a/src/core/ddsc/src/dds_reader.c +++ b/src/core/ddsc/src/dds_reader.c @@ -372,7 +372,7 @@ STATUS_CB_IMPL (reader, sample_lost, SAMPLE_LOST, STATUS_CB_IMPL (reader, requested_deadline_missed, REQUESTED_DEADLINE_MISSED, total_count_change) STATUS_CB_IMPL (reader, requested_incompatible_qos, REQUESTED_INCOMPATIBLE_QOS, total_count_change) -void dds_reader_status_cb (void *entity, const ddsi_status_cb_data_t *data) +void dds_reader_status_cb (void *entity, const struct ddsi_status_cb_data *data) { dds_reader * const rd = entity; From da78bcfb8dbe22c25422c17f8b8508e9a5aa636b Mon Sep 17 00:00:00 2001 From: Splinter1984 Date: Wed, 28 Jun 2023 16:01:00 +0200 Subject: [PATCH 4/5] MISRA rule 8-3 fix for more code in ddsc --- src/core/ddsc/include/dds/ddsc/dds_internal_api.h | 4 ++-- src/core/ddsc/src/dds_dynamic_type.c | 2 +- src/core/ddsc/src/dds_publisher.c | 2 +- src/core/ddsc/src/dds_rhc_default.c | 2 +- src/core/ddsc/src/dds_subscriber.c | 2 +- src/core/ddsc/src/dds_whc.c | 4 ++-- src/core/ddsc/src/dds_writer.c | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/ddsc/include/dds/ddsc/dds_internal_api.h b/src/core/ddsc/include/dds/ddsc/dds_internal_api.h index 35f4da8aed..0acc11269f 100644 --- a/src/core/ddsc/include/dds/ddsc/dds_internal_api.h +++ b/src/core/ddsc/include/dds/ddsc/dds_internal_api.h @@ -43,12 +43,12 @@ extern "C" { * available samples issue #74. As a work around to support LENGTH_UNLIMITED in C++. * dds_reader_lock_samples() and @ref DDS_READ_WITHOUT_LOCK are needed. * - * @param[in] reader Reader to lock the cache of. + * @param[in] entity Reader to lock the cache of. * * @returns the number of samples in the reader cache. */ DDS_EXPORT uint32_t -dds_reader_lock_samples (dds_entity_t reader); +dds_reader_lock_samples (dds_entity_t entity); /** * @ingroup internal diff --git a/src/core/ddsc/src/dds_dynamic_type.c b/src/core/ddsc/src/dds_dynamic_type.c index a7ac86bbba..f74fd39768 100644 --- a/src/core/ddsc/src/dds_dynamic_type.c +++ b/src/core/ddsc/src/dds_dynamic_type.c @@ -535,7 +535,7 @@ dds_return_t dds_dynamic_member_set_must_understand (dds_dynamic_type_t *type, u return (type->ret = set_member_bool_prop (type, member_id, is_must_understand, ddsi_dynamic_type_member_set_must_understand, 0)); } -dds_return_t dds_dynamic_type_register (dds_dynamic_type_t *type, dds_typeinfo_t **type_info) +dds_return_t dds_dynamic_type_register (dds_dynamic_type_t *type, struct ddsi_typeinfo **type_info) { dds_return_t ret; if ((ret = check_type_param (type, false)) != DDS_RETCODE_OK) diff --git a/src/core/ddsc/src/dds_publisher.c b/src/core/ddsc/src/dds_publisher.c index 86bf745bac..4cddde28d1 100644 --- a/src/core/ddsc/src/dds_publisher.c +++ b/src/core/ddsc/src/dds_publisher.c @@ -47,7 +47,7 @@ const struct dds_entity_deriver dds_entity_deriver_publisher = { .refresh_statistics = dds_entity_deriver_dummy_refresh_statistics }; -dds_entity_t dds__create_publisher_l (dds_participant *participant, bool implicit, const dds_qos_t *qos, const dds_listener_t *listener) +dds_entity_t dds__create_publisher_l (struct dds_participant *participant, bool implicit, const dds_qos_t *qos, const dds_listener_t *listener) { dds_publisher *pub; dds_entity_t hdl; diff --git a/src/core/ddsc/src/dds_rhc_default.c b/src/core/ddsc/src/dds_rhc_default.c index 2870dc5196..8679587370 100644 --- a/src/core/ddsc/src/dds_rhc_default.c +++ b/src/core/ddsc/src/dds_rhc_default.c @@ -588,7 +588,7 @@ struct dds_rhc *dds_rhc_default_new_xchecks (dds_reader *reader, struct ddsi_dom return &rhc->common; } -struct dds_rhc *dds_rhc_default_new (dds_reader *reader, const struct ddsi_sertype *type) +struct dds_rhc *dds_rhc_default_new (struct dds_reader *reader, const struct ddsi_sertype *type) { return dds_rhc_default_new_xchecks (reader, &reader->m_entity.m_domain->gv, type, (reader->m_entity.m_domain->gv.config.enabled_xchecks & DDSI_XCHECK_RHC) != 0); } diff --git a/src/core/ddsc/src/dds_subscriber.c b/src/core/ddsc/src/dds_subscriber.c index e2f58b7624..de258f9d8c 100644 --- a/src/core/ddsc/src/dds_subscriber.c +++ b/src/core/ddsc/src/dds_subscriber.c @@ -46,7 +46,7 @@ const struct dds_entity_deriver dds_entity_deriver_subscriber = { .refresh_statistics = dds_entity_deriver_dummy_refresh_statistics }; -dds_entity_t dds__create_subscriber_l (dds_participant *participant, bool implicit, const dds_qos_t *qos, const dds_listener_t *listener) +dds_entity_t dds__create_subscriber_l (struct dds_participant *participant, bool implicit, const dds_qos_t *qos, const dds_listener_t *listener) { /* participant entity lock must be held */ dds_subscriber *sub; diff --git a/src/core/ddsc/src/dds_whc.c b/src/core/ddsc/src/dds_whc.c index 7a34b067bb..e5dc0ea19f 100644 --- a/src/core/ddsc/src/dds_whc.c +++ b/src/core/ddsc/src/dds_whc.c @@ -437,9 +437,9 @@ struct whc_writer_info *dds_whc_make_wrinfo (struct dds_writer *wr, const dds_qo return wrinfo; } -void dds_whc_free_wrinfo (struct whc_writer_info *wrinfo) +void dds_whc_free_wrinfo (struct whc_writer_info *info) { - ddsrt_free (wrinfo); + ddsrt_free (info); } struct ddsi_whc *dds_whc_new (struct ddsi_domaingv *gv, const struct whc_writer_info *wrinfo) diff --git a/src/core/ddsc/src/dds_writer.c b/src/core/ddsc/src/dds_writer.c index ed9a0ba644..0ad0726307 100644 --- a/src/core/ddsc/src/dds_writer.c +++ b/src/core/ddsc/src/dds_writer.c @@ -502,7 +502,7 @@ dds_entity_t dds_get_publisher (dds_entity_t writer) } } -dds_return_t dds__writer_data_allocator_init (const dds_writer *wr, dds_data_allocator_t *data_allocator) +dds_return_t dds__writer_data_allocator_init (const struct dds_writer *wr, dds_data_allocator_t *data_allocator) { #ifdef DDS_HAS_SHM dds_iox_allocator_t *d = (dds_iox_allocator_t *) data_allocator->opaque.bytes; @@ -524,7 +524,7 @@ dds_return_t dds__writer_data_allocator_init (const dds_writer *wr, dds_data_all #endif } -dds_return_t dds__writer_data_allocator_fini (const dds_writer *wr, dds_data_allocator_t *data_allocator) +dds_return_t dds__writer_data_allocator_fini (const struct dds_writer *wr, dds_data_allocator_t *data_allocator) { #ifdef DDS_HAS_SHM dds_iox_allocator_t *d = (dds_iox_allocator_t *) data_allocator->opaque.bytes; From 4deeb847f12826ddaab1dbe56ab1f59448991496 Mon Sep 17 00:00:00 2001 From: Splinter1984 Date: Fri, 30 Jun 2023 16:59:42 +0200 Subject: [PATCH 5/5] Apply suggestion for rule 8-3 --- src/core/ddsc/include/dds/dds.h | 12 ++--- .../ddsc/include/dds/ddsc/dds_internal_api.h | 4 +- .../ddsc/include/dds/ddsc/dds_public_status.h | 44 +++++++++---------- src/core/ddsc/include/dds/ddsc/dds_rhc.h | 8 ++-- src/core/ddsc/src/dds__get_status.h | 4 +- src/core/ddsc/src/dds__reader.h | 6 +-- src/core/ddsc/src/dds_entity.c | 4 +- src/core/ddsc/src/dds_guardcond.c | 4 +- src/core/ddsc/src/dds_reader.c | 8 ++-- src/core/ddsc/src/dds_rhc.c | 4 +- src/core/ddsc/src/dds_waitset.c | 4 +- src/ddsrt/include/dds/ddsrt/string.h | 8 ++-- src/ddsrt/src/string.c | 6 +-- 13 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/core/ddsc/include/dds/dds.h b/src/core/ddsc/include/dds/dds.h index 7aa9eef603..0907f0286c 100644 --- a/src/core/ddsc/include/dds/dds.h +++ b/src/core/ddsc/include/dds/dds.h @@ -2458,7 +2458,7 @@ dds_write(dds_entity_t writer, const void *data); * datapackets for network efficiency. The normal `dds_write()` no longer * guarantee that data is sent on the network automatically. * - * @param[in] writer The writer entity. + * @param[in] entity The writer entity. * @returns A dds_return_t indicating success or failure. * @retval DDS_RETCODE_OK @@ -2473,7 +2473,7 @@ dds_write(dds_entity_t writer, const void *data); * The entity has already been deleted. */ DDS_EXPORT dds_return_t -dds_write_flush(dds_entity_t writer); +dds_write_flush(dds_entity_t entity); /** * @brief Write a serialized value of a data instance @@ -2668,7 +2668,7 @@ dds_create_querycondition( * This means that the guardcondition can be used to wake up a waitset when * data is in the reader history with states that matches the given mask. * - * @param[in] participant Participant on which to create the guardcondition. + * @param[in] owner Participant on which to create the guardcondition. * * @returns A valid condition handle or an error code. * @@ -2682,7 +2682,7 @@ dds_create_querycondition( * The entity has already been deleted. */ DDS_EXPORT dds_entity_t -dds_create_guardcondition(dds_entity_t participant); +dds_create_guardcondition(dds_entity_t owner); /** * @brief Sets the trigger status of a guardcondition. @@ -2769,7 +2769,7 @@ typedef intptr_t dds_attach_t; * conditions of the attached entities evaluates to TRUE or until the timeout * expires. * - * @param[in] participant Domain participant which the WaitSet contains. + * @param[in] owner Domain participant which the WaitSet contains. * * @returns A valid waitset handle or an error code. * @@ -2783,7 +2783,7 @@ typedef intptr_t dds_attach_t; * The entity has already been deleted. */ DDS_EXPORT dds_entity_t -dds_create_waitset(dds_entity_t participant); +dds_create_waitset(dds_entity_t owner); /** * @brief Acquire previously attached entities. diff --git a/src/core/ddsc/include/dds/ddsc/dds_internal_api.h b/src/core/ddsc/include/dds/ddsc/dds_internal_api.h index 0acc11269f..35f4da8aed 100644 --- a/src/core/ddsc/include/dds/ddsc/dds_internal_api.h +++ b/src/core/ddsc/include/dds/ddsc/dds_internal_api.h @@ -43,12 +43,12 @@ extern "C" { * available samples issue #74. As a work around to support LENGTH_UNLIMITED in C++. * dds_reader_lock_samples() and @ref DDS_READ_WITHOUT_LOCK are needed. * - * @param[in] entity Reader to lock the cache of. + * @param[in] reader Reader to lock the cache of. * * @returns the number of samples in the reader cache. */ DDS_EXPORT uint32_t -dds_reader_lock_samples (dds_entity_t entity); +dds_reader_lock_samples (dds_entity_t reader); /** * @ingroup internal diff --git a/src/core/ddsc/include/dds/ddsc/dds_public_status.h b/src/core/ddsc/include/dds/ddsc/dds_public_status.h index 67845be6d8..841c416cda 100644 --- a/src/core/ddsc/include/dds/ddsc/dds_public_status.h +++ b/src/core/ddsc/include/dds/ddsc/dds_public_status.h @@ -202,7 +202,7 @@ dds_inconsistent_topic_status_t; * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The topic entity to get the status + * @param[in] topic The topic entity to get the status * @param[out] status The pointer to @ref dds_inconsistent_topic_status_t to get the status * * @returns 0 - Success @@ -219,7 +219,7 @@ dds_inconsistent_topic_status_t; */ DDS_EXPORT dds_return_t dds_get_inconsistent_topic_status ( - dds_entity_t entity, + dds_entity_t topic, dds_inconsistent_topic_status_t * status); /** @@ -231,7 +231,7 @@ dds_get_inconsistent_topic_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The writer entity to get the status + * @param[in] writer The writer entity to get the status * @param[out] status The pointer to @ref dds_publication_matched_status_t to get the status * * @returns 0 - Success @@ -248,7 +248,7 @@ dds_get_inconsistent_topic_status ( */ DDS_EXPORT dds_return_t dds_get_publication_matched_status ( - dds_entity_t entity, + dds_entity_t writer, dds_publication_matched_status_t * status); /** @@ -260,7 +260,7 @@ dds_get_publication_matched_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The writer entity to get the status + * @param[in] writer The writer entity to get the status * @param[out] status The pointer to @ref dds_liveliness_lost_status_t to get the status * * @returns 0 - Success @@ -277,7 +277,7 @@ dds_get_publication_matched_status ( */ DDS_EXPORT dds_return_t dds_get_liveliness_lost_status ( - dds_entity_t entity, + dds_entity_t writer, dds_liveliness_lost_status_t * status); /** @@ -289,7 +289,7 @@ dds_get_liveliness_lost_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The writer entity to get the status + * @param[in] writer The writer entity to get the status * @param[out] status The pointer to @ref dds_offered_deadline_missed_status_t to get the status * * @returns 0 - Success @@ -306,7 +306,7 @@ dds_get_liveliness_lost_status ( */ DDS_EXPORT dds_return_t dds_get_offered_deadline_missed_status( - dds_entity_t entity, + dds_entity_t writer, dds_offered_deadline_missed_status_t *status); /** @@ -318,7 +318,7 @@ dds_get_offered_deadline_missed_status( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The writer entity to get the status + * @param[in] writer The writer entity to get the status * @param[out] status The pointer to @ref dds_offered_incompatible_qos_status_t to get the status * * @returns 0 - Success @@ -335,7 +335,7 @@ dds_get_offered_deadline_missed_status( */ DDS_EXPORT dds_return_t dds_get_offered_incompatible_qos_status ( - dds_entity_t entity, + dds_entity_t writer, dds_offered_incompatible_qos_status_t * status); /** @@ -347,7 +347,7 @@ dds_get_offered_incompatible_qos_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The reader entity to get the status + * @param[in] reader The reader entity to get the status * @param[out] status The pointer to @ref dds_subscription_matched_status_t to get the status * * @returns 0 - Success @@ -364,7 +364,7 @@ dds_get_offered_incompatible_qos_status ( */ DDS_EXPORT dds_return_t dds_get_subscription_matched_status ( - dds_entity_t entity, + dds_entity_t reader, dds_subscription_matched_status_t * status); /** @@ -376,7 +376,7 @@ dds_get_subscription_matched_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The reader entity to get the status + * @param[in] reader The reader entity to get the status * @param[out] status The pointer to @ref dds_liveliness_changed_status_t to get the status * * @returns 0 - Success @@ -393,7 +393,7 @@ dds_get_subscription_matched_status ( */ DDS_EXPORT dds_return_t dds_get_liveliness_changed_status ( - dds_entity_t entity, + dds_entity_t reader, dds_liveliness_changed_status_t * status); /** @@ -405,7 +405,7 @@ dds_get_liveliness_changed_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The reader entity to get the status + * @param[in] reader The reader entity to get the status * @param[out] status The pointer to @ref dds_sample_rejected_status_t to get the status * * @returns 0 - Success @@ -422,7 +422,7 @@ dds_get_liveliness_changed_status ( */ DDS_EXPORT dds_return_t dds_get_sample_rejected_status ( - dds_entity_t entity, + dds_entity_t reader, dds_sample_rejected_status_t * status); /** @@ -434,7 +434,7 @@ dds_get_sample_rejected_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The reader entity to get the status + * @param[in] reader The reader entity to get the status * @param[out] status The pointer to @ref dds_sample_lost_status_t to get the status * * @returns A dds_return_t indicating success or failure @@ -452,7 +452,7 @@ dds_get_sample_rejected_status ( */ DDS_EXPORT dds_return_t dds_get_sample_lost_status ( - dds_entity_t entity, + dds_entity_t reader, dds_sample_lost_status_t * status); /** @@ -464,7 +464,7 @@ dds_get_sample_lost_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The reader entity to get the status + * @param[in] reader The reader entity to get the status * @param[out] status The pointer to @ref dds_requested_deadline_missed_status_t to get the status * * @returns A dds_return_t indicating success or failure @@ -482,7 +482,7 @@ dds_get_sample_lost_status ( */ DDS_EXPORT dds_return_t dds_get_requested_deadline_missed_status ( - dds_entity_t entity, + dds_entity_t reader, dds_requested_deadline_missed_status_t * status); /** @@ -494,7 +494,7 @@ dds_get_requested_deadline_missed_status ( * and reset the status. The value can be obtained, only if the status is enabled for an entity. * NULL value for status is allowed and it will reset the trigger value when status is enabled. * - * @param[in] entity The reader entity to get the status + * @param[in] reader The reader entity to get the status * @param[out] status The pointer to @ref dds_requested_incompatible_qos_status_t to get the status * * @returns A dds_return_t indicating success or failure @@ -512,7 +512,7 @@ dds_get_requested_deadline_missed_status ( */ DDS_EXPORT dds_return_t dds_get_requested_incompatible_qos_status ( - dds_entity_t entity, + dds_entity_t reader, dds_requested_incompatible_qos_status_t * status); #if defined (__cplusplus) diff --git a/src/core/ddsc/include/dds/ddsc/dds_rhc.h b/src/core/ddsc/include/dds/ddsc/dds_rhc.h index 1ecd459065..0f7bc0f968 100644 --- a/src/core/ddsc/include/dds/ddsc/dds_rhc.h +++ b/src/core/ddsc/include/dds/ddsc/dds_rhc.h @@ -63,13 +63,13 @@ DDS_INLINE_EXPORT inline dds_return_t dds_rhc_associate (struct dds_rhc *rhc, st } /** @component rhc */ -DDS_INLINE_EXPORT inline bool dds_rhc_store (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict pwr_info, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk) { - return rhc->common.ops->rhc_ops.store (&rhc->common.rhc, pwr_info, sample, tk); +DDS_INLINE_EXPORT inline bool dds_rhc_store (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wr_info, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk) { + return rhc->common.ops->rhc_ops.store (&rhc->common.rhc, wr_info, sample, tk); } /** @component rhc */ -DDS_INLINE_EXPORT inline void dds_rhc_unregister_wr (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict pwr_info) { - rhc->common.ops->rhc_ops.unregister_wr (&rhc->common.rhc, pwr_info); +DDS_INLINE_EXPORT inline void dds_rhc_unregister_wr (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wr_info) { + rhc->common.ops->rhc_ops.unregister_wr (&rhc->common.rhc, wr_info); } /** @component rhc */ diff --git a/src/core/ddsc/src/dds__get_status.h b/src/core/ddsc/src/dds__get_status.h index 76b5232df3..fbe03e2ee9 100644 --- a/src/core/ddsc/src/dds__get_status.h +++ b/src/core/ddsc/src/dds__get_status.h @@ -21,11 +21,11 @@ } #define DDS_GET_STATUS_COMMON(ent_type_, status_) \ - dds_return_t dds_get_##status_##_status (dds_entity_t entity, dds_##status_##_status_t *status) \ + dds_return_t dds_get_##status_##_status (dds_entity_t ent_type_, dds_##status_##_status_t *status) \ { \ dds_##ent_type_ *ent; \ dds_return_t ret; \ - if ((ret = dds_##ent_type_##_lock (entity, &ent)) != DDS_RETCODE_OK) \ + if ((ret = dds_##ent_type_##_lock (ent_type_, &ent)) != DDS_RETCODE_OK) \ return ret; \ ddsrt_mutex_lock (&ent->m_entity.m_observers_lock); \ dds_get_##status_##_status_locked (ent, status); \ diff --git a/src/core/ddsc/src/dds__reader.h b/src/core/ddsc/src/dds__reader.h index 575786b559..c942e714c1 100644 --- a/src/core/ddsc/src/dds__reader.h +++ b/src/core/ddsc/src/dds__reader.h @@ -20,7 +20,7 @@ extern "C" { struct ddsi_status_cb_data; /** @component reader */ -void dds_reader_status_cb (void *entity, const struct ddsi_status_cb_data * data); +void dds_reader_status_cb (void *ventity, const struct ddsi_status_cb_data * data); /** @component reader */ dds_return_t dds_return_reader_loan (dds_reader *rd, void **buf, int32_t bufsz); @@ -39,10 +39,10 @@ dds_return_t dds_return_reader_loan (dds_reader *rd, void **buf, int32_t bufsz); * * Used to support LENGTH_UNLIMITED in C++. * - * @param entity reader entity + * @param reader reader entity * @return the number of samples */ -DDS_EXPORT uint32_t dds_reader_lock_samples (dds_entity_t entity); +DDS_EXPORT uint32_t dds_reader_lock_samples (dds_entity_t reader); DEFINE_ENTITY_LOCK_UNLOCK(dds_reader, DDS_KIND_READER, reader) diff --git a/src/core/ddsc/src/dds_entity.c b/src/core/ddsc/src/dds_entity.c index 28a064c00d..546d8bda0f 100644 --- a/src/core/ddsc/src/dds_entity.c +++ b/src/core/ddsc/src/dds_entity.c @@ -1735,11 +1735,11 @@ static void pushdown_write_flush (dds_entity *e) ddsrt_mutex_unlock (&e->m_mutex); } -dds_return_t dds_write_flush (dds_entity_t writer) +dds_return_t dds_write_flush (dds_entity_t entity) { dds_entity *e; dds_return_t rc; - if ((rc = dds_entity_pin (writer, &e)) != DDS_RETCODE_OK) + if ((rc = dds_entity_pin (entity, &e)) != DDS_RETCODE_OK) return rc; struct ddsi_thread_state * const thrst = ddsi_lookup_thread_state (); ddsi_thread_state_awake (thrst, &e->m_domain->gv); diff --git a/src/core/ddsc/src/dds_guardcond.c b/src/core/ddsc/src/dds_guardcond.c index aa27d86102..8cb46982ea 100644 --- a/src/core/ddsc/src/dds_guardcond.c +++ b/src/core/ddsc/src/dds_guardcond.c @@ -31,7 +31,7 @@ const struct dds_entity_deriver dds_entity_deriver_guardcondition = { .refresh_statistics = dds_entity_deriver_dummy_refresh_statistics }; -dds_entity_t dds_create_guardcondition (dds_entity_t participant) +dds_entity_t dds_create_guardcondition (dds_entity_t owner) { dds_entity *e; dds_return_t rc; @@ -43,7 +43,7 @@ dds_entity_t dds_create_guardcondition (dds_entity_t participant) if ((rc = dds_init ()) < 0) return rc; - if ((rc = dds_entity_lock (participant, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK) + if ((rc = dds_entity_lock (owner, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK) goto err_entity_lock; switch (dds_entity_kind (e)) diff --git a/src/core/ddsc/src/dds_reader.c b/src/core/ddsc/src/dds_reader.c index be39b5054c..b94d1bdcf1 100644 --- a/src/core/ddsc/src/dds_reader.c +++ b/src/core/ddsc/src/dds_reader.c @@ -372,9 +372,9 @@ STATUS_CB_IMPL (reader, sample_lost, SAMPLE_LOST, STATUS_CB_IMPL (reader, requested_deadline_missed, REQUESTED_DEADLINE_MISSED, total_count_change) STATUS_CB_IMPL (reader, requested_incompatible_qos, REQUESTED_INCOMPATIBLE_QOS, total_count_change) -void dds_reader_status_cb (void *entity, const struct ddsi_status_cb_data *data) +void dds_reader_status_cb (void *ventity, const struct ddsi_status_cb_data *data) { - dds_reader * const rd = entity; + dds_reader * const rd = ventity; /* When data is NULL, it means that the DDSI reader is deleted. */ if (data == NULL) @@ -758,11 +758,11 @@ dds_entity_t dds_create_reader_rhc (dds_entity_t participant_or_subscriber, dds_ return dds_create_reader_int (participant_or_subscriber, topic, qos, listener, rhc); } -uint32_t dds_reader_lock_samples (dds_entity_t entity) +uint32_t dds_reader_lock_samples (dds_entity_t reader) { dds_reader *rd; uint32_t n; - if (dds_reader_lock (entity, &rd) != DDS_RETCODE_OK) + if (dds_reader_lock (reader, &rd) != DDS_RETCODE_OK) return 0; n = dds_rhc_lock_samples (rd->m_rhc); dds_reader_unlock (rd); diff --git a/src/core/ddsc/src/dds_rhc.c b/src/core/ddsc/src/dds_rhc.c index 8d86126c4f..f8fc8c6d1b 100644 --- a/src/core/ddsc/src/dds_rhc.c +++ b/src/core/ddsc/src/dds_rhc.c @@ -14,8 +14,8 @@ #include "dds/ddsc/dds_rhc.h" DDS_EXPORT extern inline dds_return_t dds_rhc_associate (struct dds_rhc *rhc, struct dds_reader *reader, const struct ddsi_sertype *type, struct ddsi_tkmap *tkmap); -DDS_EXPORT extern inline bool dds_rhc_store (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict pwr_info, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk); -DDS_EXPORT extern inline void dds_rhc_unregister_wr (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict pwr_info); +DDS_EXPORT extern inline bool dds_rhc_store (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wr_info, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk); +DDS_EXPORT extern inline void dds_rhc_unregister_wr (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wr_info); DDS_EXPORT extern inline void dds_rhc_relinquish_ownership (struct dds_rhc * __restrict rhc, const uint64_t wr_iid); DDS_EXPORT extern inline void dds_rhc_set_qos (struct dds_rhc *rhc, const struct dds_qos *qos); DDS_EXPORT extern inline void dds_rhc_free (struct dds_rhc *rhc); diff --git a/src/core/ddsc/src/dds_waitset.c b/src/core/ddsc/src/dds_waitset.c index 2857dbe4d1..c35acb457f 100644 --- a/src/core/ddsc/src/dds_waitset.c +++ b/src/core/ddsc/src/dds_waitset.c @@ -142,7 +142,7 @@ const struct dds_entity_deriver dds_entity_deriver_waitset = { .refresh_statistics = dds_entity_deriver_dummy_refresh_statistics }; -dds_entity_t dds_create_waitset (dds_entity_t participant) +dds_entity_t dds_create_waitset (dds_entity_t owner) { dds_entity *e; dds_return_t rc; @@ -154,7 +154,7 @@ dds_entity_t dds_create_waitset (dds_entity_t participant) if ((rc = dds_init ()) < 0) return rc; - if ((rc = dds_entity_lock (participant, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK) + if ((rc = dds_entity_lock (owner, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK) goto err_entity_lock; switch (dds_entity_kind (e)) diff --git a/src/ddsrt/include/dds/ddsrt/string.h b/src/ddsrt/include/dds/ddsrt/string.h index 23ce74dcfc..5851ddd681 100644 --- a/src/ddsrt/include/dds/ddsrt/string.h +++ b/src/ddsrt/include/dds/ddsrt/string.h @@ -75,16 +75,16 @@ ddsrt_strsep( * is obtained with @ddsrt_malloc and must be freed with @ddsrt_free when it * is no longer used. * - * @param[in] ptr Pointer to block of memory to duplicate. - * @param[in] len Number of bytes to copy into newly allocated buffer. + * @param[in] src Pointer to block of memory to duplicate. + * @param[in] n Number of bytes to copy into newly allocated buffer. * * @returns A new block of memory that is a duplicate of the block pointed to * by @ptr or NULL if not enough memory was available. */ DDS_EXPORT void * ddsrt_memdup( - const void *ptr, - size_t len) + const void *src, + size_t n) ddsrt_nonnull((1)) ddsrt_attribute_malloc; diff --git a/src/ddsrt/src/string.c b/src/ddsrt/src/string.c index f632a859b0..c6720a4edf 100644 --- a/src/ddsrt/src/string.c +++ b/src/ddsrt/src/string.c @@ -144,12 +144,12 @@ ddsrt_strlcat( } void * -ddsrt_memdup(const void *ptr, size_t len) +ddsrt_memdup(const void *src, size_t n) { void *dest = NULL; - if (len != 0 && (dest = ddsrt_malloc_s(len)) != NULL) { - memcpy(dest, ptr, len); + if (n != 0 && (dest = ddsrt_malloc_s(n)) != NULL) { + memcpy(dest, src, n); } return dest;