Beispiel #1
0
T Array_new(size_t length, size_t size)
{
	T array;
	NEW(array);
	if (length > 0)
		ArrayRep_init(array, length, size,
			CALLOC(length, size));
	else
		ArrayRep_init(array, length, size, NULL);
	return array;
}
Beispiel #2
0
T Array_new(int length, int size)
{
    T array;
    NEW(array);

    if (length > 0)
        ArrayRep_init(array, length, size,
                      CALLOC(length, size));
    else {
        ArrayRep_init(array, length, size, NULL);
    }

    return array;
}
Beispiel #3
0
Datei: seq.c Projekt: wime12/CII
T Seq_new(int hint) {
    T seq;
    assert(hint >= 0);
    NEW0(seq);
    if (hint == 0)
	hint = 16;
    ArrayRep_init(&seq->array, hint, sizeof (void *),
	    ALLOC(hint*sizeof (void *)));
    return seq;
}
Beispiel #4
0
T Seq_new(int hint)
{
    T seq;
    assert(hint >=0);
    NEW0(seq);
    if (hint == 0)
        hint = 16;
    //Elements in seq->array are pointers
    ArrayRep_init(&seq->array, hint, sizeof(void *),
            ALLOC(hint * sizeof(void *)));
    seq->head = 0;
    return seq;
}