memcpy(newDev->doxm->mom, src->doxm->mom, sizeof(OicSecMom_t));
if (src->doxm->subOwners) {
+ int count = 0;
OicSecSubOwner_t* subowner = NULL;
OicSecSubOwner_t* temp = NULL;
OicSecSubOwner_t* temp2 = NULL;
+ OicSecSubOwner_t* temp3 = NULL;
LL_FOREACH_SAFE(src->doxm->subOwners, subowner, temp) {
temp2 = g_try_malloc0(sizeof(OicSecSubOwner_t));
- memcpy(temp2, subowner, sizeof(OicSecSubOwner_t));
- LL_APPEND(newDev->doxm->subOwners, temp2);
+ temp3 = subowner;
+ temp3->next = NULL;
+ memcpy(temp2, temp3, sizeof(OicSecSubOwner_t));
+ LL_PREPEND(newDev->doxm->subOwners, temp2);
}
+ LL_COUNT(newDev->doxm->subOwners, subowner, count);
+ MA_LOGD("newdev subowner count %d", count);
}
}
if (!_get_dev_by_uuid(dev_list, uuid)) {
MA_LOGD("Add device %s to list", _get_readable_uuid(uuid));
- OCProvisionDev_t *temp2;
- OCProvisionDev_t *temp = iter;
- temp->next = NULL;
- temp2 = _clone_ocprovision_dev(temp);
- LL_APPEND(dev_list, temp2);
+ OCProvisionDev_t *temp;
+ temp = _clone_ocprovision_dev(iter);
/* Notify Mot Enabled Device added */
g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(&builder, "{sv}", "devStatus",
g_variant_new_uint32(iter->devStatus));
- if (con->cid == MA_DISC_MOT_ENB_DEVS)
+ if (con->cid == MA_DISC_MOT_ENB_DEVS) {
ma_notify_mot_enb_dev_added(g_variant_builder_end(&builder));
- else
+ LL_APPEND(g_client->g_motdev_list, temp);
+ } else {
ma_notify_mowned_dev_added(g_variant_builder_end(&builder));
+ LL_APPEND(g_client->g_mowned_list, temp);
+ }
} else {
MA_LOGD("Device %s already exist", _get_readable_uuid(uuid));
}
iter = iter->next;
}
-
- if (con->cid == MA_DISC_MOT_ENB_DEVS)
- g_client->g_motdev_list = dev_list;
- else if (con->cid == MA_DISC_MOWNED_DEVS)
- g_client->g_mowned_list = dev_list;
}
static gpointer _disc_mot_env_devs_func(gpointer data)