commit 135ebdaa25a96d573311cec6cdacd7941ae82836
parent ea90342cac097d3cfc513fb733ad9e51a24a0136
Author: Eduardo Fontana Lazzari <edufonlaz@gmail.com>
Date: Tue, 1 Apr 2025 15:20:16 +0200
Remove proxy allocator from tests
Diffstat:
5 files changed, 14 insertions(+), 32 deletions(-)
diff --git a/src/sphin_main.c b/src/sphin_main.c
@@ -65,12 +65,10 @@ parse_args(struct args* args, int argc, char** argv)
while((opt = getopt(argc, argv, "hv")) != -1) {
switch(opt) {
case 'v':
-
/* Increase the verbosity level counter for each 'v' entered, up to a maximum of 3.
- We use the boolean value of (3 > args->verbose): if the condition is
- true, it evaluates to 1, increasing the counter.
- Otherwise, it evaluates to 0, leaving the counter unchanged. */
-
+ * We use the boolean value of (3 > args->verbose): if the condition is
+ * true, it evaluates to 1, increasing the counter.
+ * Otherwise, it evaluates to 0, leaving the counter unchanged. */
args->verbose += (3 > args->verbose);
break;
case 'h':
@@ -110,7 +108,6 @@ main(int argc, char** argv)
/* Process command line args */
res = parse_args(&args, argc, argv);
if (RES_OK != res) { goto error; }
-
if (1 == args.quit) { goto exit; }
/* Initialize sphin */
@@ -119,11 +116,12 @@ main(int argc, char** argv)
/* Load stream */
if (NULL != args.filename) {
- sphin_load(sphin, args.filename, &config);
+ res = sphin_load(sphin, args.filename, &config);
}
else {
- sphin_load_stream(sphin, stdin, "stdin", &config);
+ res = sphin_load_stream(sphin, stdin, "stdin", &config);
}
+ if (RES_OK != res) { goto error; }
exit:
if (NULL != sphin) { SPHIN(ref_put(sphin)); }
diff --git a/src/test_sphin_load_geometry.c b/src/test_sphin_load_geometry.c
@@ -246,15 +246,13 @@ test_geometry_api
int
main(int argc, char** argv)
{
- struct mem_allocator allocator;
- struct sphin* sphin;
+ struct sphin* sphin = NULL;
struct sphin_create_args args = SPHIN_CREATE_ARGS_DEFAULT;
(void)argc;
(void)argv;
- args.verbose = 1;
- mem_init_proxy_allocator(&allocator, &mem_default_allocator);
+ args.verbose = 1;
sphin_create(&args, &sphin);
write_stl_test_files();
@@ -262,8 +260,6 @@ main(int argc, char** argv)
CHK(sphin_ref_put(sphin) == RES_OK);
- check_memory_allocator(&allocator);
- mem_shutdown_proxy_allocator(&allocator);
CHK(mem_allocated_size() == 0);
return 0;
}
diff --git a/src/test_sphin_load_source.c b/src/test_sphin_load_source.c
@@ -235,15 +235,13 @@ test_source_api_bad_name
int
main(int argc, char** argv)
{
- struct mem_allocator allocator;
- struct sphin* sphin;
+ struct sphin* sphin = NULL;
struct sphin_create_args args = SPHIN_CREATE_ARGS_DEFAULT;
(void)argc;
(void)argv;
- args.verbose = 1;
- mem_init_proxy_allocator(&allocator, &mem_default_allocator);
+ args.verbose = 1;
sphin_create(&args, &sphin);
write_stl_test_files();
@@ -256,8 +254,6 @@ main(int argc, char** argv)
CHK(sphin_ref_put(sphin) == RES_OK);
- check_memory_allocator(&allocator);
- mem_shutdown_proxy_allocator(&allocator);
CHK(mem_allocated_size() == 0);
return 0;
}
diff --git a/src/test_sphin_load_surface.c b/src/test_sphin_load_surface.c
@@ -227,15 +227,13 @@ test_surface_api_bad_geometry
int
main(int argc, char** argv)
{
- struct mem_allocator allocator;
- struct sphin* sphin;
+ struct sphin* sphin = NULL;
struct sphin_create_args args = SPHIN_CREATE_ARGS_DEFAULT;
(void)argc;
(void)argv;
- args.verbose = 1;
- mem_init_proxy_allocator(&allocator, &mem_default_allocator);
+ args.verbose = 1;
sphin_create(&args, &sphin);
write_stl_test_files();
@@ -247,8 +245,6 @@ main(int argc, char** argv)
CHK(sphin_ref_put(sphin) == RES_OK);
- check_memory_allocator(&allocator);
- mem_shutdown_proxy_allocator(&allocator);
CHK(mem_allocated_size() == 0);
return 0;
}
diff --git a/src/test_sphin_load_volume.c b/src/test_sphin_load_volume.c
@@ -219,15 +219,13 @@ test_volume_api_empty_file
int
main(int argc, char** argv)
{
- struct mem_allocator allocator;
- struct sphin* sphin;
+ struct sphin* sphin = NULL;
struct sphin_create_args args = SPHIN_CREATE_ARGS_DEFAULT;
(void)argc;
(void)argv;
- args.verbose = 1;
- mem_init_proxy_allocator(&allocator, &mem_default_allocator);
+ args.verbose = 1;
sphin_create(&args, &sphin);
write_stl_test_files();
@@ -238,8 +236,6 @@ main(int argc, char** argv)
CHK(sphin_ref_put(sphin) == RES_OK);
- check_memory_allocator(&allocator);
- mem_shutdown_proxy_allocator(&allocator);
CHK(mem_allocated_size() == 0);
return 0;
}