Commit f35a9e07 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

blc_mem and blc_array do not need to be destroyed explicitly.

parent cce9a576
......@@ -17,7 +17,7 @@
/**
@date Apr 28, 2014
@author Arnaud Blanchard
@defgroup blc_mem Memory strucuture with a pointer and a size.
@defgroup blc_array Blc mem more informations about type, format and dims of the data.
@{
This kind of functionnalities are more complete with the Standard Template Library (STL) but it much simpler here.
*/
......@@ -40,6 +40,7 @@ typedef struct blc_array
:blc_mem {
blc_array();
/**Free dims. The data is freed by ~blc_mem()*/
~blc_array();
/**def and does not allocate*/
......
......@@ -37,7 +37,6 @@ blc_array::~blc_array(){
if (dims) FREE(dims);
}
void blc_array::init(char const *properties){
sscan_properties(properties);
}
......
......@@ -29,7 +29,7 @@ blc_mem::blc_mem(size_t size)
}
blc_mem::~blc_mem(){
FREE(data);
if (data) FREE(data); //Problem if the memory is static or does not belong to the blc_mem.
size=0;
}
......
......@@ -28,9 +28,6 @@ int main(int argc, char **argv){
//Text on abscissa "position" and text on ordonate "intensity"
vector.fprint_graph_uchars(stderr, "Vector test", 16, 256, 0, "position", "intensity");
//We free the memory (.dims and .data)
vector.~blc_array();
fprintf(stderr, "\nDefining 3x5 float matrix\n\nDims:\n");
//We define a matrix of 3x5
......@@ -67,10 +64,6 @@ int main(int argc, char **argv){
//we compare the content of the two matrixes
if (memcmp(matrix.data, matrix_copy.data, matrix.size)!=0) EXIT_ON_ARRAY_ERROR(&matrix,"The content of the saved and reloaded matrix are not the same");
//We free the memory
matrix.~blc_array();
matrix_copy.~blc_array();
fprintf(stderr, "\nWe load an array of intensities and display the values\n\n");
......@@ -89,8 +82,5 @@ int main(int argc, char **argv){
//Print the scale
blc_fprint_color_scale(stderr);
/*Free the memory */
pixel_array.~blc_array();
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment