aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2022-02-06 21:15:58 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2022-02-06 21:15:58 +0100
commit38b3675f877328fce9cf76f28e57da8bbffad259 (patch)
treef0703e56a7a78059a2247c74e76a6c75abc4ecbc
parentcbd13cd00a23aeb5dd23577dc6d5ce13668ffad9 (diff)
downloadprops.lv2-38b3675f877328fce9cf76f28e57da8bbffad259.tar.xz
make test valgrind clean
-rw-r--r--meson_options.txt2
-rw-r--r--test/props_test.c25
2 files changed, 21 insertions, 6 deletions
diff --git a/meson_options.txt b/meson_options.txt
index 03005b2..68e7b37 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -5,4 +5,4 @@ option('lv2libdir',
type : 'string',
value : 'lib/lv2')
-option('version', type : 'string', value : '0.1.177')
+option('version', type : 'string', value : '0.1.179')
diff --git a/test/props_test.c b/test/props_test.c
index dded888..7dc4ad8 100644
--- a/test/props_test.c
+++ b/test/props_test.c
@@ -7,7 +7,7 @@
#include <src/props_private.h>
-#define MAX_URIDS 512
+#define MAX_URIDS 128
#define STR_SIZE 32
#define CHUNK_SIZE 16
#define VEC_SIZE 13
@@ -238,7 +238,9 @@ _map(LV2_URID_Map_Handle instance, const char *uri)
for(itm=handle->urids; itm->urid; itm++)
{
if(!strcmp(itm->uri, uri))
+ {
return itm->urid;
+ }
}
assert(handle->urid + 1 < MAX_URIDS);
@@ -250,6 +252,22 @@ _map(LV2_URID_Map_Handle instance, const char *uri)
return itm->urid;
}
+static void
+_map_free(handle_t *handle)
+{
+ for(unsigned i = 0; i < MAX_URIDS; i++)
+ {
+ urid_t *itm = &handle->urids[i];
+
+ if(itm->uri)
+ {
+ free(itm->uri);
+ }
+
+ memset(itm, 0x0, sizeof(urid_t));
+ }
+}
+
static const props_def_t defs [MAX_NPROPS] = {
[PROP_b32] = {
.property = PROPS_PREFIX"b32",
@@ -624,11 +642,8 @@ main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
&handle.state, &handle.stash, &handle.map, NULL) == 1);
(*test)(&handle);
- }
- for(urid_t *itm=handle.urids; itm->urid; itm++)
- {
- free(itm->uri);
+ _map_free(&handle);
}
return 0;