Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
blaar
blibs
blc_core
Commits
f35a9e07
Commit
f35a9e07
authored
Nov 25, 2016
by
Arnaud Blanchard
Browse files
blc_mem and blc_array do not need to be destroyed explicitly.
parent
cce9a576
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/blc_array.h
View file @
f35a9e07
...
...
@@ -17,7 +17,7 @@
/**
@date Apr 28, 2014
@author Arnaud Blanchard
@defgroup blc_mem
Me
mor
y strucuture with a pointer and a size
.
@defgroup blc_
array Blc
mem mor
e 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*/
...
...
src/blc_array.cpp
View file @
f35a9e07
...
...
@@ -37,7 +37,6 @@ blc_array::~blc_array(){
if
(
dims
)
FREE
(
dims
);
}
void
blc_array
::
init
(
char
const
*
properties
){
sscan_properties
(
properties
);
}
...
...
src/blc_mem.cpp
View file @
f35a9e07
...
...
@@ -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
;
}
...
...
t_array/main.cpp
View file @
f35a9e07
...
...
@@ -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
,
"
\n
Defining 3x5 float matrix
\n\n
Dims:
\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
,
"
\n
We 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
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment