version 1.1, 2015/04/20 18:19:50
|
version 1.2, 2015/09/25 20:24:20
|
|
|
#include "ptrarray.h" | #include "ptrarray.h" |
#include <stdlib.h> | #include <stdlib.h> |
|
#include <pal/intsafe.h> |
| |
int PtrArray_Construct( | int PtrArray_Construct( |
PtrArray* self, | PtrArray* self, |
|
|
self->capacity = capacity; | self->capacity = capacity; |
self->destructor = destructor; | self->destructor = destructor; |
| |
self->data = (void**)PAL_Malloc(self->capacity * sizeof(void*)); |
size_t allocSize = 0; |
|
if (SizeTMult(self->capacity, sizeof(void*), &allocSize) == S_OK) |
|
{ |
|
self->data = (void**)PAL_Malloc(allocSize); |
|
} |
| |
if (!self->data) | if (!self->data) |
return -1; | return -1; |