Ignore:
Timestamp:
Aug 23, 2017, 6:22:07 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
87e08e24, cb811ac
Parents:
9f07232 (diff), bd37119 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/vector/vector_int.c

    r9f07232 rd3e4d6c  
    2020#define DEFAULT_CAPACITY 20
    2121
    22 void ?{}( vector_int * vec ) {
     22void ?{}( vector_int & vec ) {
    2323        vec { DEFAULT_CAPACITY };
    2424}
    2525
    26 void ?{}( vector_int * vec, int reserve ) {
    27         vec->last = -1;
    28         vec->capacity = reserve;
    29         vec->data = malloc( sizeof( int ) * reserve );
     26void ?{}( vector_int & vec, int reserve ) {
     27        vec.last = -1;
     28        vec.capacity = reserve;
     29        vec.data = malloc( sizeof( int ) * reserve );
    3030}
    3131
    32 void ?{}( vector_int * vec, vector_int other ) {
    33         vec->last = other.last;
    34         vec->capacity = other.capacity;
    35         vec->data = malloc( sizeof( int ) * other.capacity );
    36         for (int i = 0; i < vec->last; i++) {
    37                 vec->data[i] = other.data[i];
     32void ?{}( vector_int & vec, vector_int other ) {
     33        vec.last = other.last;
     34        vec.capacity = other.capacity;
     35        vec.data = malloc( sizeof( int ) * other.capacity );
     36        for (int i = 0; i < vec.last; i++) {
     37                vec.data[i] = other.data[i];
    3838        }
    3939}
    4040
    41 void ^?{}( vector_int * vec ) {
    42         free( vec->data );
     41void ^?{}( vector_int & vec ) {
     42        free( vec.data );
    4343}
    4444
     
    6161// implement bounded_array
    6262
    63 lvalue int ?[?]( vector_int * vec, int index ) {
     63int & ?[?]( vector_int * vec, int index ) {
    6464        return vec->data[ index ];
    6565}
Note: See TracChangeset for help on using the changeset viewer.