summaryrefslogtreecommitdiffstats
path: root/Vector.c
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-02-02 15:53:02 +0100
committerHisham <hisham@gobolinux.org>2016-02-02 15:53:02 +0100
commitb54d2dde407921caa7561dde6b45831ba93d0840 (patch)
treecd81eea35dd65e46d22f2801ea403e1efc06eb59 /Vector.c
parenta1f7f2869ec2bd860d5b4e4b39736ca877afdf6f (diff)
Check for failure in allocations.
Diffstat (limited to 'Vector.c')
-rw-r--r--Vector.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Vector.c b/Vector.c
index 8200564c..0cdf9af2 100644
--- a/Vector.c
+++ b/Vector.c
@@ -37,9 +37,9 @@ Vector* Vector_new(ObjectClass* type, bool owner, int size) {
if (size == DEFAULT_SIZE)
size = 10;
- this = malloc(sizeof(Vector));
+ this = xMalloc(sizeof(Vector));
this->growthRate = size;
- this->array = (Object**) calloc(size, sizeof(Object*));
+ this->array = (Object**) xCalloc(size, sizeof(Object*));
this->arraySize = size;
this->items = 0;
this->type = type;
@@ -179,7 +179,7 @@ static void Vector_checkArraySize(Vector* this) {
//int i;
//i = this->arraySize;
this->arraySize = this->items + this->growthRate;
- this->array = (Object**) realloc(this->array, sizeof(Object*) * this->arraySize);
+ this->array = (Object**) xRealloc(this->array, sizeof(Object*) * this->arraySize);
//for (; i < this->arraySize; i++)
// this->array[i] = NULL;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy