Changeset cdbfab0 for src/tests/vector


Ignore:
Timestamp:
Nov 17, 2017, 4:57:57 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:
4d5e57b
Parents:
0fe4e62
Message:

Remove unsafe void * constructors and assignment operators from prelude [closes #24] [fixes #51]

File:
1 edited

Legend:

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

    r0fe4e62 rcdbfab0  
    2727        vec.last = -1;
    2828        vec.capacity = reserve;
    29         vec.data = malloc( sizeof( int ) * reserve );
     29        vec.data = (int *)malloc( sizeof( int ) * reserve );
    3030}
    3131
     
    3333        vec.last = other.last;
    3434        vec.capacity = other.capacity;
    35         vec.data = malloc( sizeof( int ) * other.capacity );
     35        vec.data = (int *)malloc( sizeof( int ) * other.capacity );
    3636        for (int i = 0; i < vec.last; i++) {
    3737                vec.data[i] = other.data[i];
     
    4545void reserve( vector_int *vec, int reserve ) {
    4646        if ( reserve > vec->capacity ) {
    47                 vec->data = realloc( vec->data, sizeof( int ) * reserve );
     47                vec->data = (int *)realloc( vec->data, sizeof( int ) * reserve );
    4848                vec->capacity = reserve;
    4949        }
     
    5454        if ( vec->last == vec->capacity ) {
    5555                vec->capacity *= 2;
    56                 vec->data = realloc( vec->data, sizeof( int ) * vec->capacity );
     56                vec->data = (int *)realloc( vec->data, sizeof( int ) * vec->capacity );
    5757        }
    5858        vec->data[ vec->last ] = element;
Note: See TracChangeset for help on using the changeset viewer.