Esempio n. 1
0
int
lmt_cbr_get_metrics (char *names, List *rlp)
{
    int retval = -1;
    List rl = NULL;
    List nl = NULL;
    ListIterator itr = NULL;
    cerebro_t ch = NULL;
    char *name;

    if (!(ch = cerebro_handle_create()))
        goto done;
    nl = list_tok (names, ",");
    rl = list_create ((ListDelF)_destroy_cmetric);
    itr = list_iterator_create (nl);
    while ((name = list_next (itr))) {
        if (_get_metric_data (ch, name, rl) < 0)
            goto done;
    }
    *rlp = rl;
    retval = 0;
done:    
    if (itr)
        list_iterator_destroy (itr);
    if (retval < 0 && rl)
        list_destroy (rl);
    if (nl)
        list_destroy (nl);
    if (ch)
        cerebro_handle_destroy (ch);
    return retval;
}
Esempio n. 2
0
void 
_parser::_enumerate_value_list(
	std::vector<node> &statement,
	size_t parent_position
	)
{
	token tok, list_tok(TOKEN_VALUE_LIST);

	parent_position = _append_token(insert_token(list_tok), statement, parent_position);
	_advance_token();
	_enumerate_value(statement, parent_position);
	tok = get_token();

	while(tok.get_type() == TOKEN_SYMBOL
			&& tok.get_subtype() == SYMBOL_LIST_SEPERATOR) {
		_advance_token();
		_enumerate_value(statement, parent_position);
		tok = get_token();
	}
}