Changeset 2afec66 for src/tests/vector


Ignore:
Timestamp:
Jul 26, 2017, 5:24:33 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
25bd9074
Parents:
8a6cf7e
Message:

Update several tests for references

Location:
src/tests/vector
Files:
2 edited

Legend:

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

    r8a6cf7e r2afec66  
    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 ) {
     41void ^?{}( vector_int & vec ) {
    4242        free( vec->data );
    4343}
  • src/tests/vector/vector_int.h

    r8a6cf7e r2afec66  
    2525} vector_int;
    2626
    27 void ?{}( vector_int * );                                                               // allocate vector with default capacity
    28 void ?{}( vector_int *, int reserve );          // allocate vector with specified capacity
    29 void ?{}( vector_int * vec, vector_int other ); // copy constructor
    30 void ^?{}( vector_int * );                                                              // deallocate vector's storage
     27void ?{}( vector_int & );                                                               // allocate vector with default capacity
     28void ?{}( vector_int &, int reserve );          // allocate vector with specified capacity
     29void ?{}( vector_int & vec, vector_int other ); // copy constructor
     30void ^?{}( vector_int & );                                                              // deallocate vector's storage
    3131
    3232void reserve( vector_int *vec, int reserve );                   // reserve more capacity
Note: See TracChangeset for help on using the changeset viewer.