fixed a memory leak in lexer, all tests are now memory safe
This commit is contained in:
parent
cb48a9f573
commit
a9a26ec122
8 changed files with 378 additions and 518 deletions
|
|
@ -85,10 +85,10 @@ int main(){
|
|||
//print the values within the vector
|
||||
for(uint32_t index = 0; index < ARC_Vector_GetSize(vector); index++){
|
||||
//cast the return value back to what it initially was
|
||||
valueRef = (int32_t *)ARC_Vector_Get(vector, index);
|
||||
int32_t *valueRef = (int32_t *)ARC_Vector_Get(vector, index);
|
||||
|
||||
//print out the index and value
|
||||
printf("%d) %d\n", index, *value);
|
||||
printf("%d) %d\n", index, *valueRef);
|
||||
}
|
||||
|
||||
//remove the value
|
||||
|
|
@ -97,10 +97,10 @@ int main(){
|
|||
//print the values again to show that the value was removed
|
||||
for(uint32_t index = 0; index < ARC_Vector_GetSize(vector); index++){
|
||||
//cast the return value back to what it initially was
|
||||
valueRef = (int32_t *)ARC_Vector_Get(vector, index);
|
||||
int32_t *valueRef = (int32_t *)ARC_Vector_Get(vector, index);
|
||||
|
||||
//print out the index and value
|
||||
printf("%d) %d\n", index, *value);
|
||||
printf("%d) %d\n", index, *valueRef);
|
||||
}
|
||||
|
||||
//cleanup
|
||||
|
|
@ -147,10 +147,10 @@ int main(){
|
|||
//print the values within the vector
|
||||
for(uint32_t index = 0; index < ARC_Vector_GetSize(vector); index++){
|
||||
//cast the return value back to what it initially was
|
||||
valueRef = (int32_t *)ARC_Vector_Get(vector, index);
|
||||
int32_t *valueRef = (int32_t *)ARC_Vector_Get(vector, index);
|
||||
|
||||
//print out the index and value
|
||||
printf("%d) %d\n", index, *value);
|
||||
printf("%d) %d\n", index, *valueRef);
|
||||
}
|
||||
|
||||
//example to demonstrate that there is no memory leak on removal due to the destroy callback
|
||||
|
|
@ -159,10 +159,10 @@ int main(){
|
|||
//print the values again to show that the value was removed
|
||||
for(uint32_t index = 0; index < ARC_Vector_GetSize(vector); index++){
|
||||
//cast the return value back to what it initially was
|
||||
valueRef = (int32_t *)ARC_Vector_Get(vector, index);
|
||||
int32_t valueRef = (int32_t *)ARC_Vector_Get(vector, index);
|
||||
|
||||
//print out the index and value
|
||||
printf("%d) %d\n", index, *value);
|
||||
printf("%d) %d\n", index, *valueRef);
|
||||
}
|
||||
|
||||
//cleanup
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue