Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Update code regarding recent API changes on Soletta
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Dilly <[email protected]>
  • Loading branch information
bdilly committed Jul 14, 2016
1 parent 5686de2 commit e59bc82
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions sml/common/src/sml_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ sml_cache_set_max_size(struct sml_cache *cache, uint16_t max_elements)

cache->max_elements = max_elements;
while (sol_ptr_vector_get_len(&cache->elements) > max_elements) {
to_del = sol_ptr_vector_take(&cache->elements, 0);
to_del = sol_ptr_vector_steal(&cache->elements, 0);
if (!to_del) {
sml_critical("Could not remove an element from the cache!");
return false;
Expand Down Expand Up @@ -104,7 +104,7 @@ sml_cache_put(struct sml_cache *cache, void *data)
void *to_del;

if (cache->max_elements && count == cache->max_elements) {
to_del = sol_ptr_vector_take(&cache->elements, 0);
to_del = sol_ptr_vector_steal(&cache->elements, 0);
if (!to_del) {
sml_critical("Could not remove the oldest element in the cache");
return false;
Expand Down Expand Up @@ -188,7 +188,7 @@ sml_cache_remove_by_id(struct sml_cache *cache, uint16_t elem)
{
void *to_del;

to_del = sol_ptr_vector_take(&cache->elements, elem);
to_del = sol_ptr_vector_steal(&cache->elements, elem);
if (!to_del) {
sml_critical("Could not remove the oldest element in the cache");
return false;
Expand Down
2 changes: 1 addition & 1 deletion sml/sml_ann/src/sml_ann_variable_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ sml_ann_variable_list_remove(struct sml_variables_list *list, uint16_t index)
{
struct sml_variables_list_impl *impl =
(struct sml_variables_list_impl *)list;
struct sml_variable *var = sol_ptr_vector_take(&impl->variables, index);
struct sml_variable *var = sol_ptr_vector_steal(&impl->variables, index);

if (!var) {
sml_critical("Could not remove the index %d", index);
Expand Down
14 changes: 7 additions & 7 deletions soletta_module/machine_learning/machine_learning.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,8 @@ input_var_process(struct sol_flow_node *node, void *data, uint16_t port,
return -EINVAL;
}

if ((!sol_util_double_equal(input_var->base.value.min, value.min)) ||
(!sol_util_double_equal(input_var->base.value.max, value.max)))
if ((!sol_util_double_eq(input_var->base.value.min, value.min)) ||
(!sol_util_double_eq(input_var->base.value.max, value.max)))
input_var->base.range_changed = true;
input_var->base.value = value;
pthread_mutex_unlock(&mdata->read_lock);
Expand Down Expand Up @@ -803,8 +803,8 @@ output_var_process(struct sol_flow_node *node, void *data, uint16_t port,
}
}

if ((!sol_util_double_equal(output_var->base.value.min, value.min)) ||
(!sol_util_double_equal(output_var->base.value.max, value.max)))
if ((!sol_util_double_eq(output_var->base.value.min, value.min)) ||
(!sol_util_double_eq(output_var->base.value.max, value.max)))
output_var->base.range_changed = true;
output_var->base.value = value;
output_var->predicted_value = NAN;
Expand Down Expand Up @@ -1285,8 +1285,8 @@ machine_learning_sync_update_variables(struct machine_learning_sync_data *mdata,
if (!sml_variable_get_range(mdata->base.sml, var, &min, &max))
return -EINVAL;

if ((!sol_util_double_equal(min, val->min)) ||
(!sol_util_double_equal(max, val->max))) {
if ((!sol_util_double_eq(min, val->min)) ||
(!sol_util_double_eq(max, val->max))) {
width = fmax((val->max - val->min + 1) /
mdata->base.number_of_terms, val->step);

Expand Down Expand Up @@ -1872,7 +1872,7 @@ learn_disabled_process(struct sol_flow_node *node, void *data, uint16_t port,
bool disabled;
int r;

r = sol_flow_packet_get_boolean(packet, &disabled);
r = sol_flow_packet_get_bool(packet, &disabled);
SOL_INT_CHECK(r, < 0, r);

if (mdata->learn_disabled == disabled)
Expand Down
2 changes: 1 addition & 1 deletion soletta_module/sml_garden/sml_garden.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ engine_state_process(struct sol_flow_node *node, void *data,
struct sml_garden_data *sdata = data;
time_t now = time(NULL);

r = sol_flow_packet_get_boolean(packet, &engine_is_on);
r = sol_flow_packet_get_bool(packet, &engine_is_on);
SOL_INT_CHECK(r, < 0, r);

if (engine_is_on)
Expand Down

0 comments on commit e59bc82

Please sign in to comment.