Beispiel #1
0
void private_finc_struct_init_data(ADT value, ADT data)
{
    FinCField* l_field;
    Vector* l_vector;
    FinCData* l_data;

    l_field  = (FinCField*)value;
    l_vector = (Vector*)data;

    l_data = finc_data_new( l_field->type, (char*)private_data_p + l_field->offset);
    vector_set_at(l_vector, l_field->index, (ADT)l_data);
    unref(l_data);
}
Beispiel #2
0
/**
 * add a value to the vector
 * @param vec the vector to append the value to
 * @param val the vlue to add
 */
int vector_push(vector_t * vec, void *val)
{
#ifdef DEBUG
    assert(NULL != vec);
    assert(NULL != val);
#endif

    if (vec->count == (vec->slots - 1)) {
        /* too big, add more slots */
        if (!vector_resize(vec)) {
            /* sorry! */
            ERRF(__FILE__, __LINE__, "could not resize vector, failed...\n");
            return 0;
        }
    }

    vector_set_at(vec, vec->count, val);

    return 1;
}