trivial modifications to pacify gcc -O2 and clang --analyze

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-01-02 12:09:15 +01:00
parent b70e88c16f
commit ed06ab8f4b
19 changed files with 106 additions and 116 deletions

View file

@ -370,7 +370,8 @@ dds__builtin_write(
_In_ nn_wctime_t timestamp,
_In_ bool alive)
{
dds_entity_t topic;
/* initialize to avoid compiler warning ultimately caused by C's horrible type system */
dds_entity_t topic = 0;
switch (type)
{
case DSBT_PARTICIPANT:
@ -383,6 +384,7 @@ dds__builtin_write(
topic = DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION;
break;
}
assert(topic != 0);
(void)dds__builtin_write_int(topic, guid, timestamp.v, alive);
}

View file

@ -1120,6 +1120,16 @@ dds_triggered(
}
static bool in_observer_list_p (const struct dds_entity *observed, const dds_entity_t observer)
{
dds_entity_observer *cur;
for (cur = observed->m_observers; cur != NULL; cur = cur->m_next) {
if (cur->m_observer == observer) {
return true;
}
}
return false;
}
_Check_return_ dds__retcode_t
dds_entity_observer_register_nl(
@ -1127,30 +1137,19 @@ dds_entity_observer_register_nl(
_In_ dds_entity_t observer,
_In_ dds_entity_callback cb)
{
dds__retcode_t rc = DDS_RETCODE_OK;
dds__retcode_t rc;
dds_entity_observer *o = os_malloc(sizeof(dds_entity_observer));
assert(observed);
o->m_cb = cb;
o->m_observer = observer;
o->m_next = NULL;
os_mutexLock(&observed->m_observers_lock);
if (observed->m_observers == NULL) {
observed->m_observers = o;
} else {
dds_entity_observer *last;
dds_entity_observer *idx = observed->m_observers;
while ((idx != NULL) && (o != NULL)) {
if (idx->m_observer == observer) {
os_free(o);
o = NULL;
if (in_observer_list_p (observed, observer)) {
rc = DDS_RETCODE_PRECONDITION_NOT_MET;
}
last = idx;
idx = idx->m_next;
}
if (o != NULL) {
last->m_next = o;
}
os_free (o);
} else {
rc = DDS_RETCODE_OK;
o->m_next = observed->m_observers;
observed->m_observers = o;
}
os_mutexUnlock(&observed->m_observers_lock);
return rc;

View file

@ -325,14 +325,12 @@ dds_reader_status_cb(
/* There's a deletion or closing going on. */
}
} else if (rc == DDS_RETCODE_NO_DATA) {
/* Nobody was interested through a listener (NO_DATA == NO_CALL): set the status. */
/* Nobody was interested through a listener (NO_DATA == NO_CALL): set the status, consider successful. */
dds_entity_status_set(entity, data->status);
/* Notify possible interested observers. */
dds_entity_status_signal(entity);
rc = DDS_RETCODE_OK;
} else if (rc == DDS_RETCODE_ALREADY_DELETED) {
/* An entity up the hierarchy is being deleted. */
rc = DDS_RETCODE_OK;
/* An entity up the hierarchy is being deleted, consider successful. */
} else {
/* Something went wrong up the hierarchy. */
}

View file

@ -367,6 +367,7 @@ static void remove_inst_from_nonempty_list (struct rhc *rhc, struct rhc_instance
#ifndef NDEBUG
{
const struct rhc_instance *x = rhc->nonempty_instances;
assert (x);
do { if (x == inst) break; x = x->next; } while (x != rhc->nonempty_instances);
assert (x == inst);
}
@ -2132,7 +2133,7 @@ void dds_rhc_add_readcondition (dds_readcond * cond)
DDS_TRACE("add_readcondition(%p, %x, %x, %x) => %p qminv %x ; rhc %u conds\n",
(void *) rhc, cond->m_sample_states, cond->m_view_states,
cond->m_instance_states, cond, cond->m_qminv, rhc->nconds);
cond->m_instance_states, (void *) cond, cond->m_qminv, rhc->nconds);
os_mutexUnlock (&rhc->conds_lock);
os_mutexUnlock (&rhc->lock);

View file

@ -130,14 +130,12 @@ dds_topic_status_cb(
dds_topic_unlock(topic);
}
} else if (rc == DDS_RETCODE_NO_DATA) {
/* Nobody was interested through a listener (NO_DATA == NO_CALL): set the status. */
/* Nobody was interested through a listener (NO_DATA == NO_CALL): set the status; consider it successful. */
dds_entity_status_set((dds_entity*)topic, DDS_INCONSISTENT_TOPIC_STATUS);
/* Notify possible interested observers. */
dds_entity_status_signal((dds_entity*)topic);
rc = DDS_RETCODE_OK;
} else if (rc == DDS_RETCODE_ALREADY_DELETED) {
/* An entity up the hierarchy is being deleted. */
rc = DDS_RETCODE_OK;
/* An entity up the hierarchy is being deleted; consider it successful. */
} else {
/* Something went wrong up the hierarchy. */
}
@ -318,7 +316,7 @@ static bool dupdef_qos_ok(const dds_qos_t *qos, const struct ddsi_sertopic *st)
static bool sertopic_equivalent (const struct ddsi_sertopic *a, const struct ddsi_sertopic *b)
{
printf ("sertopic_equivalent %p %p (%s %s; %u %u; %p %p; %p %p)\n", a, b, a->name_typename, b->name_typename, a->serdata_basehash, b->serdata_basehash, a->ops, b->ops, a->serdata_ops, b->serdata_ops);
printf ("sertopic_equivalent %p %p (%s %s; %u %u; %p %p; %p %p)\n", (void*)a, (void*)b, a->name_typename, b->name_typename, a->serdata_basehash, b->serdata_basehash, (void *)a->ops, (void *)b->ops, (void *)a->serdata_ops, (void *)b->serdata_ops);
if (strcmp (a->name_typename, b->name_typename) != 0)
return false;

View file

@ -170,14 +170,12 @@ dds_writer_status_cb(
/* There's a deletion or closing going on. */
}
} else if (rc == DDS_RETCODE_NO_DATA) {
/* Nobody was interested through a listener (NO_DATA == NO_CALL): set the status. */
/* Nobody was interested through a listener (NO_DATA == NO_CALL): set the status; consider it successful. */
dds_entity_status_set(entity, data->status);
/* Notify possible interested observers. */
dds_entity_status_signal(entity);
rc = DDS_RETCODE_OK;
} else if (rc == DDS_RETCODE_ALREADY_DELETED) {
/* An entity up the hierarchy is being deleted. */
rc = DDS_RETCODE_OK;
/* An entity up the hierarchy is being deleted; consider it successful. */
} else {
/* Something went wrong up the hierarchy. */
}
@ -395,12 +393,6 @@ static struct whc *make_whc(const dds_qos_t *qos)
} else {
tldepth = 0;
}
if (hdepth == 0 && tldepth == 0)
{
/* no index at all - so no need to bother with startup mode */
startup_mode = 0;
}
return whc_new (handle_as_transient_local, hdepth, tldepth);
}

View file

@ -133,7 +133,7 @@ struct ddsi_serdata *ddsi_serdata_builtin_from_keyhash (const struct ddsi_sertop
const struct entity_common *entity = ephash_lookup_guid_untyped ((const nn_guid_t *) keyhash->value);
struct ddsi_serdata_builtin *d = serdata_builtin_new(tp, entity ? SDK_DATA : SDK_KEY);
memcpy (&d->key, keyhash->value, sizeof (d->key));
if (d->c.kind == SDK_DATA)
if (entity)
{
switch (entity->kind)
{

View file

@ -60,7 +60,7 @@ static void serdata_free_wrap (void *elem)
void ddsi_serdatapool_free (struct serdatapool * pool)
{
DDS_TRACE("ddsi_serdatapool_free(%p)\n", pool);
DDS_TRACE("ddsi_serdatapool_free(%p)\n", (void *) pool);
nn_freelist_fini (&pool->freelist, serdata_free_wrap);
os_free (pool);
}

View file

@ -114,7 +114,7 @@ static void sertopic_builtin_free_samples (const struct ddsi_sertopic *sertopic_
#endif
if (op & DDS_FREE_CONTENTS_BIT)
{
void (*f) (void *);
void (*f) (void *) = 0;
char *ptr = ptrs[0];
switch (tp->type)
{
@ -126,6 +126,7 @@ static void sertopic_builtin_free_samples (const struct ddsi_sertopic *sertopic_
f = free_endpoint;
break;
}
assert (f != 0);
for (size_t i = 0; i < count; i++)
{
f (ptr);

View file

@ -202,7 +202,7 @@ retry:
if (tk && rd)
{
DDS_TRACE("tk=%p iid=%"PRIx64" ", &tk, tk->m_iid);
DDS_TRACE("tk=%p iid=%"PRIx64" ", (void *) &tk, tk->m_iid);
}
return tk;
}

View file

@ -240,7 +240,10 @@ void local_reader_ary_setinvalid (struct local_reader_ary *x)
static void write_builtin_topic_any (const struct entity_common *e, nn_wctime_t timestamp, bool alive, nn_vendorid_t vendorid, struct ddsi_tkmap_instance *tk)
{
enum ddsi_sertopic_builtin_type type;
if (!(e->onlylocal || is_builtin_endpoint(e->guid.entityid, vendorid)))
{
/* initialize to avoid gcc warning ultimately caused by C's horrible type system */
enum ddsi_sertopic_builtin_type type = DSBT_PARTICIPANT;
switch (e->kind)
{
case EK_PARTICIPANT:
@ -256,8 +259,9 @@ static void write_builtin_topic_any (const struct entity_common *e, nn_wctime_t
type = DSBT_WRITER;
break;
}
if (!(e->onlylocal || is_builtin_endpoint(e->guid.entityid, vendorid)))
assert(type != DSBT_PARTICIPANT || (e->kind == EK_PARTICIPANT || e->kind == EK_PROXY_PARTICIPANT));
ddsi_plugin.builtin_write (type, &e->guid, timestamp, alive);
}
/* tkmap instance only needs to be kept around until the first write of a built-in topic (if none ever happens, it needn't be kept at all): afterward, the WHC of the local built-in topic writer will keep the entry alive. FIXME: the SPDP/SEPD ones currently use default sertopics instead of builtin sertopics, and so use different mappings and different instnace ids. No-one ever sees those ids, so it doesn't matter, but it would nicer if it could actually be the same one. FIXME: it would also be nicer if the local built-in topics and the SPDP/SEDP writers were the same, but I want the locally created endpoints visible in the built-in topics as well, and those don't exist in the discovery writers ... */
if (tk)
ddsi_tkmap_instance_unref (tk);

View file

@ -3477,7 +3477,7 @@ void nn_xqos_fini (nn_xqos_t *xqos)
else
{
/* until proper message buffers arrive */
DDS_LOG(DDS_LC_PLIST, "NN_XQOS_FINI free %p\n", xqos->partition.strs);
DDS_LOG(DDS_LC_PLIST, "NN_XQOS_FINI free %p\n", (void *) xqos->partition.strs);
os_free (xqos->partition.strs);
}
}
@ -3488,7 +3488,7 @@ void nn_xqos_fini (nn_xqos_t *xqos)
else
{
/* until proper message buffers arrive */
DDS_LOG(DDS_LC_PLIST, "NN_XQOS_FINI free %p\n", xqos->subscription_keys.key_list.strs);
DDS_LOG(DDS_LC_PLIST, "NN_XQOS_FINI free %p\n", (void *) xqos->subscription_keys.key_list.strs);
os_free (xqos->subscription_keys.key_list.strs);
}
}

View file

@ -425,7 +425,7 @@ static struct nn_rbuf *nn_rbuf_alloc_new (struct nn_rbufpool *rbufpool)
rb->size = rbufpool->rbuf_size;
rb->max_rmsg_size = rbufpool->max_rmsg_size;
rb->freeptr = rb->u.raw;
DDS_LOG(DDS_LC_RADMIN, "rbuf_alloc_new(%p) = %p\n", rbufpool, rb);
DDS_LOG(DDS_LC_RADMIN, "rbuf_alloc_new(%p) = %p\n", (void *) rbufpool, (void *) rb);
return rb;
}
@ -447,10 +447,10 @@ static struct nn_rbuf *nn_rbuf_new (struct nn_rbufpool *rbufpool)
static void nn_rbuf_release (struct nn_rbuf *rbuf)
{
struct nn_rbufpool *rbp = rbuf->rbufpool;
DDS_LOG(DDS_LC_RADMIN, "rbuf_release(%p) pool %p current %p\n", rbuf, rbp, rbp->current);
DDS_LOG(DDS_LC_RADMIN, "rbuf_release(%p) pool %p current %p\n", (void *) rbuf, (void *) rbp, (void *) rbp->current);
if (os_atomic_dec32_ov (&rbuf->n_live_rmsg_chunks) == 1)
{
DDS_LOG(DDS_LC_RADMIN, "rbuf_release(%p) free\n", rbuf);
DDS_LOG(DDS_LC_RADMIN, "rbuf_release(%p) free\n", (void *) rbuf);
os_free (rbuf);
}
}
@ -513,7 +513,7 @@ struct nn_rmsg *nn_rmsg_new (struct nn_rbufpool *rbufpool)
{
/* Note: only one thread calls nn_rmsg_new on a pool */
struct nn_rmsg *rmsg;
DDS_LOG(DDS_LC_RADMIN, "rmsg_new(%p)\n", rbufpool);
DDS_LOG(DDS_LC_RADMIN, "rmsg_new(%p)\n", (void *) rbufpool);
rmsg = nn_rbuf_alloc (rbufpool);
if (rmsg == NULL)
@ -526,14 +526,14 @@ struct nn_rmsg *nn_rmsg_new (struct nn_rbufpool *rbufpool)
rmsg->lastchunk = &rmsg->chunk;
/* Incrementing freeptr happens in commit(), so that discarding the
message is really simple. */
DDS_LOG(DDS_LC_RADMIN, "rmsg_new(%p) = %p\n", rbufpool, rmsg);
DDS_LOG(DDS_LC_RADMIN, "rmsg_new(%p) = %p\n", (void *) rbufpool, (void *) rmsg);
return rmsg;
}
void nn_rmsg_setsize (struct nn_rmsg *rmsg, uint32_t size)
{
uint32_t size8 = align8uint32 (size);
DDS_LOG(DDS_LC_RADMIN, "rmsg_setsize(%p, %u => %u)\n", rmsg, size, size8);
DDS_LOG(DDS_LC_RADMIN, "rmsg_setsize(%p, %u => %u)\n", (void *) rmsg, size, size8);
ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
ASSERT_RMSG_UNCOMMITTED (rmsg);
assert (os_atomic_ld32 (&rmsg->refcount) == RMSG_REFCOUNT_UNCOMMITTED_BIAS);
@ -556,7 +556,7 @@ void nn_rmsg_free (struct nn_rmsg *rmsg)
free() which we don't do currently. And ideally, you'd use
compare-and-swap for this. */
struct nn_rmsg_chunk *c;
DDS_LOG(DDS_LC_RADMIN, "rmsg_free(%p)\n", rmsg);
DDS_LOG(DDS_LC_RADMIN, "rmsg_free(%p)\n", (void *) rmsg);
assert (os_atomic_ld32 (&rmsg->refcount) == 0);
c = &rmsg->chunk;
while (c)
@ -579,7 +579,7 @@ void nn_rmsg_free (struct nn_rmsg *rmsg)
static void commit_rmsg_chunk (struct nn_rmsg_chunk *chunk)
{
struct nn_rbuf *rbuf = chunk->rbuf;
DDS_LOG(DDS_LC_RADMIN, "commit_rmsg_chunk(%p)\n", chunk);
DDS_LOG(DDS_LC_RADMIN, "commit_rmsg_chunk(%p)\n", (void *) chunk);
rbuf->freeptr = chunk->u.payload + chunk->size;
}
@ -595,7 +595,7 @@ void nn_rmsg_commit (struct nn_rmsg *rmsg)
completed before we got to commit. */
struct nn_rmsg_chunk *chunk = rmsg->lastchunk;
DDS_LOG(DDS_LC_RADMIN, "rmsg_commit(%p) refcount 0x%x last-chunk-size %u\n",
rmsg, rmsg->refcount.v, chunk->size);
(void *) rmsg, rmsg->refcount.v, chunk->size);
ASSERT_RBUFPOOL_OWNER (chunk->rbuf->rbufpool);
ASSERT_RMSG_UNCOMMITTED (rmsg);
assert (chunk->size <= chunk->rbuf->max_rmsg_size);
@ -610,7 +610,7 @@ void nn_rmsg_commit (struct nn_rmsg *rmsg)
{
/* Other references exist, so either stored in defrag, reorder
and/or delivery queue */
DDS_LOG(DDS_LC_RADMIN, "rmsg_commit(%p) => keep\n", rmsg);
DDS_LOG(DDS_LC_RADMIN, "rmsg_commit(%p) => keep\n", (void *) rmsg);
commit_rmsg_chunk (chunk);
}
}
@ -623,7 +623,7 @@ static void nn_rmsg_addbias (struct nn_rmsg *rmsg)
However, other threads (e.g., delivery threads) may have been
triggered already, so the increment must be done atomically. */
DDS_LOG(DDS_LC_RADMIN, "rmsg_addbias(%p)\n", rmsg);
DDS_LOG(DDS_LC_RADMIN, "rmsg_addbias(%p)\n", (void *) rmsg);
ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
ASSERT_RMSG_UNCOMMITTED (rmsg);
os_atomic_add32 (&rmsg->refcount, RMSG_REFCOUNT_RDATA_BIAS);
@ -635,7 +635,7 @@ static void nn_rmsg_rmbias_and_adjust (struct nn_rmsg *rmsg, int adjust)
progressing through the pipeline, but only by the receive
thread. Can't require it to be uncommitted. */
uint32_t sub;
DDS_LOG(DDS_LC_RADMIN, "rmsg_rmbias_and_adjust(%p, %d)\n", rmsg, adjust);
DDS_LOG(DDS_LC_RADMIN, "rmsg_rmbias_and_adjust(%p, %d)\n", (void *) rmsg, adjust);
ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
assert (adjust >= 0);
assert ((uint32_t) adjust < RMSG_REFCOUNT_RDATA_BIAS);
@ -649,14 +649,14 @@ static void nn_rmsg_rmbias_anythread (struct nn_rmsg *rmsg)
{
/* For removing garbage when freeing a nn_defrag. */
uint32_t sub = RMSG_REFCOUNT_RDATA_BIAS;
DDS_LOG(DDS_LC_RADMIN, "rmsg_rmbias_anythread(%p)\n", rmsg);
DDS_LOG(DDS_LC_RADMIN, "rmsg_rmbias_anythread(%p)\n", (void *) rmsg);
assert (os_atomic_ld32 (&rmsg->refcount) >= sub);
if (os_atomic_sub32_nv (&rmsg->refcount, sub) == 0)
nn_rmsg_free (rmsg);
}
static void nn_rmsg_unref (struct nn_rmsg *rmsg)
{
DDS_LOG(DDS_LC_RADMIN, "rmsg_unref(%p)\n", rmsg);
DDS_LOG(DDS_LC_RADMIN, "rmsg_unref(%p)\n", (void *) rmsg);
assert (os_atomic_ld32 (&rmsg->refcount) > 0);
if (os_atomic_dec32_ov (&rmsg->refcount) == 1)
nn_rmsg_free (rmsg);
@ -668,7 +668,7 @@ void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size)
struct nn_rbuf *rbuf = chunk->rbuf;
uint32_t size8 = align8uint32 (size);
void *ptr;
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u => %u)\n", rmsg, size, size8);
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u => %u)\n", (void *) rmsg, size, size8);
ASSERT_RBUFPOOL_OWNER (rbuf->rbufpool);
ASSERT_RMSG_UNCOMMITTED (rmsg);
assert ((chunk->size % 8) == 0);
@ -678,7 +678,7 @@ void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size)
{
struct nn_rbufpool *rbufpool = rbuf->rbufpool;
struct nn_rmsg_chunk *newchunk;
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u) limit hit - new chunk\n", rmsg, size);
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u) limit hit - new chunk\n", (void *) rmsg, size);
commit_rmsg_chunk (chunk);
newchunk = nn_rbuf_alloc (rbufpool);
if (newchunk == NULL)
@ -693,7 +693,7 @@ void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size)
ptr = chunk->u.payload + chunk->size;
chunk->size += size8;
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u) = %p\n", rmsg, size, ptr);
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u) = %p\n", (void *) rmsg, size, ptr);
#if USE_VALGRIND
if (chunk == &rmsg->chunk) {
VALGRIND_MEMPOOL_CHANGE (rbuf->rbufpool, rmsg, rmsg, offsetof (struct nn_rmsg, chunk.u.payload) + chunk->size);
@ -720,13 +720,13 @@ struct nn_rdata *nn_rdata_new (struct nn_rmsg *rmsg, uint32_t start, uint32_t en
#ifndef NDEBUG
os_atomic_st32 (&d->refcount_bias_added, 0);
#endif
DDS_LOG(DDS_LC_RADMIN, "rdata_new(%p, bytes [%u,%u), submsg @ %u, payload @ %u) = %p\n", rmsg, start, endp1, NN_RDATA_SUBMSG_OFF (d), NN_RDATA_PAYLOAD_OFF (d), d);
DDS_LOG(DDS_LC_RADMIN, "rdata_new(%p, bytes [%u,%u), submsg @ %u, payload @ %u) = %p\n", (void *) rmsg, start, endp1, NN_RDATA_SUBMSG_OFF (d), NN_RDATA_PAYLOAD_OFF (d), (void *) d);
return d;
}
static void nn_rdata_addbias (struct nn_rdata *rdata)
{
DDS_LOG(DDS_LC_RADMIN, "rdata_addbias(%p)\n", rdata);
DDS_LOG(DDS_LC_RADMIN, "rdata_addbias(%p)\n", (void *) rdata);
#ifndef NDEBUG
ASSERT_RBUFPOOL_OWNER (rdata->rmsg->chunk.rbuf->rbufpool);
if (os_atomic_inc32_nv (&rdata->refcount_bias_added) != 1)
@ -737,7 +737,7 @@ static void nn_rdata_addbias (struct nn_rdata *rdata)
static void nn_rdata_rmbias_and_adjust (struct nn_rdata *rdata, int adjust)
{
DDS_LOG(DDS_LC_RADMIN, "rdata_rmbias_and_adjust(%p, %d)\n", rdata, adjust);
DDS_LOG(DDS_LC_RADMIN, "rdata_rmbias_and_adjust(%p, %d)\n", (void *) rdata, adjust);
#ifndef NDEBUG
if (os_atomic_dec32_ov (&rdata->refcount_bias_added) != 1)
abort ();
@ -747,7 +747,7 @@ static void nn_rdata_rmbias_and_adjust (struct nn_rdata *rdata, int adjust)
static void nn_rdata_rmbias_anythread (struct nn_rdata *rdata)
{
DDS_LOG(DDS_LC_RADMIN, "rdata_rmbias_anythread(%p)\n", rdata);
DDS_LOG(DDS_LC_RADMIN, "rdata_rmbias_anythread(%p)\n", (void *) rdata);
#ifndef NDEBUG
if (os_atomic_dec32_ov (&rdata->refcount_bias_added) != 1)
abort ();
@ -757,7 +757,7 @@ static void nn_rdata_rmbias_anythread (struct nn_rdata *rdata)
static void nn_rdata_unref (struct nn_rdata *rdata)
{
DDS_LOG(DDS_LC_RADMIN, "rdata_rdata_unref(%p)\n", rdata);
DDS_LOG(DDS_LC_RADMIN, "rdata_rdata_unref(%p)\n", (void *) rdata);
nn_rmsg_unref (rdata->rmsg);
}
@ -894,7 +894,7 @@ struct nn_defrag *nn_defrag_new (enum nn_defrag_drop_mode drop_mode, uint32_t ma
void nn_fragchain_adjust_refcount (struct nn_rdata *frag, int adjust)
{
struct nn_rdata *frag1;
DDS_LOG(DDS_LC_RADMIN, "fragchain_adjust_refcount(%p, %d)\n", frag, adjust);
DDS_LOG(DDS_LC_RADMIN, "fragchain_adjust_refcount(%p, %d)\n", (void *) frag, adjust);
while (frag)
{
frag1 = frag->nextfrag;
@ -906,7 +906,7 @@ void nn_fragchain_adjust_refcount (struct nn_rdata *frag, int adjust)
static void nn_fragchain_rmbias_anythread (struct nn_rdata *frag, UNUSED_ARG (int adjust))
{
struct nn_rdata *frag1;
DDS_LOG(DDS_LC_RADMIN, "fragchain_rmbias_anythread(%p)\n", frag);
DDS_LOG(DDS_LC_RADMIN, "fragchain_rmbias_anythread(%p)\n", (void *) frag);
while (frag)
{
frag1 = frag->nextfrag;
@ -940,7 +940,7 @@ void nn_defrag_free (struct nn_defrag *defrag)
s = ut_avlFindMin (&defrag_sampletree_treedef, &defrag->sampletree);
while (s)
{
DDS_LOG(DDS_LC_RADMIN, "defrag_free(%p, sample %p seq %"PRId64")\n", defrag, s, s->u.defrag.seq);
DDS_LOG(DDS_LC_RADMIN, "defrag_free(%p, sample %p seq %"PRId64")\n", (void *) defrag, (void *) s, s->u.defrag.seq);
defrag_rsample_drop (defrag, s, nn_fragchain_rmbias_anythread);
s = ut_avlFindMin (&defrag_sampletree_treedef, &defrag->sampletree);
}
@ -1161,6 +1161,7 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
concerns the message pointer to by sample */
assert (min < maxp1);
/* and it must concern this message */
assert (dfsample);
assert (dfsample->seq == sampleinfo->seq);
/* there must be a last fragment */
assert (dfsample->lastfrag);
@ -1357,7 +1358,7 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
assert (defrag->max_sample == ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree));
max_seq = defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0;
DDS_LOG(DDS_LC_RADMIN, "defrag_rsample(%p, %p [%u..%u) msg %p, %p seq %"PRId64" size %u) max_seq %p %"PRId64":\n",
(void *) defrag, (void *) rdata, rdata->min, rdata->maxp1, rdata->rmsg,
(void *) defrag, (void *) rdata, rdata->min, rdata->maxp1, (void *) rdata->rmsg,
(void *) sampleinfo, sampleinfo->seq, sampleinfo->size,
(void *) defrag->max_sample, max_seq);
/* fast path: rdata is part of message with the highest sequence

View file

@ -2703,7 +2703,7 @@ static int handle_submsg_sequence
if (submsg + submsg_size > end)
{
DDS_TRACE(" BREAK (%u %"PRIuSIZE": %p %u)\n", (unsigned) (submsg - msg), submsg_size, msg, (unsigned) len);
DDS_TRACE(" BREAK (%u %"PRIuSIZE": %p %u)\n", (unsigned) (submsg - msg), submsg_size, (void *) msg, (unsigned) len);
break;
}
@ -2909,7 +2909,7 @@ static int handle_submsg_sequence
{
state = "parse:shortmsg";
state_smkind = SMID_PAD;
DDS_TRACE("short (size %"PRIuSIZE" exp %p act %p)", submsg_size, submsg, end);
DDS_TRACE("short (size %"PRIuSIZE" exp %p act %p)", submsg_size, (void *) submsg, (void *) end);
goto malformed;
}
return 0;
@ -3319,7 +3319,7 @@ void trigger_recv_threads (void)
break;
}
case RTM_MANY: {
DDS_TRACE("trigger_recv_threads: %d many %p\n", i, gv.recv_threads[i].arg.u.many.ws);
DDS_TRACE("trigger_recv_threads: %d many %p\n", i, (void *) gv.recv_threads[i].arg.u.many.ws);
os_sockWaitsetTrigger (gv.recv_threads[i].arg.u.many.ws);
break;
}

View file

@ -256,7 +256,7 @@ static void nn_xmsg_realfree_wrap (void *elem)
void nn_xmsgpool_free (struct nn_xmsgpool *pool)
{
nn_freelist_fini (&pool->freelist, nn_xmsg_realfree_wrap);
DDS_TRACE("xmsgpool_free(%p)\n", pool);
DDS_TRACE("xmsgpool_free(%p)\n", (void *)pool);
os_free (pool);
}

View file

@ -37,11 +37,11 @@ static dds_entity_t reader;
static dds_entity_t writer;
static dds_entity_t readCond;
static void data_available(dds_entity_t reader, void *arg)
static void data_available(dds_entity_t rd, void *arg)
{
int status, samplecount;
(void)arg;
samplecount = dds_take (reader, samples, info, MAX_SAMPLES, MAX_SAMPLES);
samplecount = dds_take (rd, samples, info, MAX_SAMPLES, MAX_SAMPLES);
DDS_ERR_CHECK (samplecount, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
for (int j = 0; !dds_triggered (waitSet) && j < samplecount; j++)
{
@ -136,18 +136,18 @@ int main (int argc, char *argv[])
return EXIT_SUCCESS;
}
static void finalize_dds(dds_entity_t participant, RoundTripModule_DataType data[MAX_SAMPLES])
static void finalize_dds(dds_entity_t pp, RoundTripModule_DataType xs[MAX_SAMPLES])
{
dds_return_t status;
status = dds_delete (participant);
status = dds_delete (pp);
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
for (unsigned int i = 0; i < MAX_SAMPLES; i++)
{
RoundTripModule_DataType_free (&data[i], DDS_FREE_CONTENTS);
RoundTripModule_DataType_free (&xs[i], DDS_FREE_CONTENTS);
}
}
static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_entity_t *readCond, dds_listener_t *listener)
static dds_entity_t prepare_dds(dds_entity_t *wr, dds_entity_t *rd, dds_entity_t *rdcond, dds_listener_t *rdlist)
{
const char *pubPartitions[] = { "pong" };
const char *subPartitions[] = { "ping" };
@ -176,8 +176,8 @@ static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_
qos = dds_create_qos ();
dds_qset_reliability (qos, DDS_RELIABILITY_RELIABLE, DDS_SECS(10));
dds_qset_writer_data_lifecycle (qos, false);
*writer = dds_create_writer (publisher, topic, qos, NULL);
DDS_ERR_CHECK (*writer, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
*wr = dds_create_writer (publisher, topic, qos, NULL);
DDS_ERR_CHECK (*wr, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
dds_delete_qos (qos);
/* A DDS Subscriber is created on the domain participant. */
@ -193,17 +193,17 @@ static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_
qos = dds_create_qos ();
dds_qset_reliability (qos, DDS_RELIABILITY_RELIABLE, DDS_SECS(10));
*reader = dds_create_reader (subscriber, topic, qos, listener);
DDS_ERR_CHECK (*reader, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
*rd = dds_create_reader (subscriber, topic, qos, rdlist);
DDS_ERR_CHECK (*rd, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
dds_delete_qos (qos);
waitSet = dds_create_waitset (participant);
if (listener == NULL) {
*readCond = dds_create_readcondition (*reader, DDS_ANY_STATE);
status = dds_waitset_attach (waitSet, *readCond, *reader);
if (rdlist == NULL) {
*rdcond = dds_create_readcondition (*rd, DDS_ANY_STATE);
status = dds_waitset_attach (waitSet, *rdcond, *rd);
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
} else {
*readCond = 0;
*rdcond = 0;
}
status = dds_waitset_attach (waitSet, waitSet, waitSet);
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);

View file

@ -207,7 +207,7 @@ static dds_return_t wait_for_reader(dds_entity_t writer, dds_entity_t participan
DDS_ERR_CHECK (waitset, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
ret = dds_waitset_attach(waitset, writer, (dds_attach_t)NULL);
DDS_ERR_CHECK (waitset, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
DDS_ERR_CHECK (ret, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
ret = dds_waitset_wait(waitset, NULL, 0, DDS_SECS(30));
DDS_ERR_CHECK (ret, DDS_CHECK_REPORT | DDS_CHECK_EXIT);

View file

@ -155,8 +155,6 @@ os_startRoutineWrapper (
os_threadContext *context = threadContext;
uintptr_t resultValue;
resultValue = 0;
#if !defined(__VXWORKS__) && !defined(__APPLE__) && !defined(__sun)
prctl(PR_SET_NAME, context->threadName);
#endif

View file

@ -805,7 +805,6 @@ static void print_sampleinfo(dds_time_t *tstart, dds_time_t tnow, const dds_samp
relt = tnow - *tstart;
// instancehandle_to_id(&ihSystemId, &ihLocalId, si->instance_handle);
// instancehandle_to_id(&phSystemId, &phLocalId, si->publication_handle);
sep = "";
if (print_metadata & PM_PID) {
n += printf ("%d", pid);
}
@ -826,7 +825,6 @@ static void print_sampleinfo(dds_time_t *tstart, dds_time_t tnow, const dds_samp
sep = " : ";
if (print_metadata & PM_STIME) {
n += printf ("%s%lld.%09lld", n > 0 ? sep : "", (si->source_timestamp/DDS_NSECS_IN_SEC), (si->source_timestamp%DDS_NSECS_IN_SEC));
sep = " ";
}
sep = " : ";
if (print_metadata & PM_DGEN) {
@ -843,7 +841,6 @@ static void print_sampleinfo(dds_time_t *tstart, dds_time_t tnow, const dds_samp
sep = " : ";
if (print_metadata & PM_STATE) {
n += printf ("%s%c%c%c", n > 0 ? sep : "", isc, ssc, vsc);
sep = " ";
}
if (n > 0) {
printf(" : ");
@ -1895,9 +1892,9 @@ static uint32_t subthread(void *vspec) {
case MODE_ZEROLOAD:
break;
case MODE_PRINT:
rc = dds_waitset_detach(ws, rdcondA);
dds_waitset_detach(ws, rdcondA);
dds_delete(rdcondA);
rc = dds_waitset_detach(ws, rdcondD);
dds_waitset_detach(ws, rdcondD);
dds_delete(rdcondD);
break;
case MODE_CHECK:
@ -1952,9 +1949,8 @@ static uint32_t autotermthread(void *varg __attribute__((unused))) {
tnow = dds_time();
}
rc = dds_waitset_detach(ws, termcond);
rc = dds_delete(ws);
dds_waitset_detach(ws, termcond);
dds_delete(ws);
return 0;
}