void sml_string_free(struct sml_string *sml_string) { ON_NULL_RETURN(sml_string); free(sml_string->str); free(sml_string); }
static char* get_operation_name(opal_list_t* attributes) { opal_value_t* temp = NULL; char* op = NULL; ON_NULL_RETURN(attributes); temp = (opal_value_t*)opal_list_get_first(attributes); ON_NULL_RETURN(temp); if (0 == strcmp(temp->key,"compute")) { if(NULL != temp->data.string) { op = strdup(temp->data.string); } return op; } else { return NULL; } }
static orcm_value_t* compute_agg(char* op, char* data_key, opal_list_t* compute, orcm_analytics_aggregate* aggregate) { orcm_value_t *temp = NULL; orcm_value_t *agg_value = NULL; if(NULL == compute || NULL == aggregate || NULL == data_key) { return NULL; } temp = (orcm_value_t*)opal_list_get_first(compute); ON_NULL_RETURN(temp); agg_value = orcm_util_load_orcm_value(data_key, &temp->value.data,OPAL_DOUBLE,temp->units); ON_NULL_RETURN(agg_value); if(0 == strncmp(op,"average", strlen(op))) { compute_average(agg_value, aggregate, compute); } else if (0 == strncmp(op, "min", strlen(op))){ compute_min(agg_value, aggregate, compute); } else if (0 == strncmp(op,"max", strlen(op))){ compute_max(agg_value, aggregate, compute); } else { SAFEFREE(agg_value); } return agg_value; }