commit 32cc436d82eeaa05e2bd6b5b50eaf4a06aab1e4e
parent 667a81a390ccfebcec816063e294bbf254f8e250
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 15 Jul 2022 10:32:41 +0200
Setup the ground name
Diffstat:
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/rngrd.c b/src/rngrd.c
@@ -25,7 +25,9 @@
#include <star/s3d.h>
#include <star/sbuf.h>
+#include <rsys/cstr.h>
#include <rsys/mem_allocator.h>
+#include <rsys/str.h>
/*******************************************************************************
* Helper functions
@@ -83,6 +85,7 @@ create_rngrd
ground->allocator = allocator;
ground->verbose = args->verbose;
darray_mtl_init(ground->allocator, &ground->mtls);
+ str_init(ground->allocator, &ground->name);
if(args->logger) {
ground->logger = args->logger;
} else {
@@ -95,6 +98,14 @@ create_rngrd
goto error;
}
}
+
+ res = str_set(&ground->name, args->name);
+ if(res != RES_OK) {
+ log_err(ground, "Could not setup the ground name to `%s' -- %s\n",
+ args->name, res_to_cstr(res));
+ goto error;
+ }
+
exit:
if(out_ground) *out_ground = ground;
return res;
@@ -119,7 +130,8 @@ release_rngrd(ref_T* ref)
struct mrumtl* mtl = darray_mtl_data_get(&ground->mtls)[i];
if(mtl) MRUMTL(ref_put(mtl));
}
-
+ darray_mtl_release(&ground->mtls);
+ str_release(&ground->name);
MEM_RM(ground->allocator, ground);
}
diff --git a/src/rngrd_c.h b/src/rngrd_c.h
@@ -26,6 +26,7 @@
#include <rsys/dynamic_array.h>
#include <rsys/logger.h>
#include <rsys/ref_count.h>
+#include <rsys/str.h>
struct rngrd_create_args;
struct mrumtl;
@@ -54,6 +55,8 @@ struct rngrd {
struct darray_mtl mtls;
struct sbuf* props;
+ struct str name;
+
int verbose;
struct logger* logger;
struct logger logger__;