changeset 42:334d883b96ba

twrtp_jibuf_create: make config argument const While this config structure is not a constant in the mathematical sense of the term (it is expected that vty config changes may happen while twjit instance is alive), twjit functions never write to it, only read, hence it is 'const' in the not-quite-mathematical C-standard sense.
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 20 Dec 2024 22:47:20 +0000
parents bda6b24385f7
children 8cdfef36d9db
files include/twjit.h src/twjit.c
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/include/twjit.h	Fri Dec 20 22:13:01 2024 +0000
+++ b/include/twjit.h	Fri Dec 20 22:47:20 2024 +0000
@@ -100,7 +100,7 @@
 struct twrtp_jibuf_inst {
 	/* pointer to config structure given to twrtp_jibuf_create(),
 	 * memory must remain valid, but content can change at any time. */
-	struct twrtp_jibuf_config *ext_config;
+	const struct twrtp_jibuf_config *ext_config;
 	/* count of RTP timestamp units per quantum */
 	uint32_t ts_quantum;
 	/* quanta per second, used to scale max_future_sec */
@@ -130,7 +130,7 @@
 /* twjit module API functions */
 
 struct twrtp_jibuf_inst *
-twrtp_jibuf_create(void *ctx, struct twrtp_jibuf_config *config);
+twrtp_jibuf_create(void *ctx, const struct twrtp_jibuf_config *config);
 
 /*
  * The default timescale is 8 kHz (8000 samples per second),
--- a/src/twjit.c	Fri Dec 20 22:13:01 2024 +0000
+++ b/src/twjit.c	Fri Dec 20 22:47:20 2024 +0000
@@ -78,7 +78,7 @@
 /* create and destroy functions */
 
 struct twrtp_jibuf_inst *
-twrtp_jibuf_create(void *ctx, struct twrtp_jibuf_config *config)
+twrtp_jibuf_create(void *ctx, const struct twrtp_jibuf_config *config)
 {
 	struct twrtp_jibuf_inst *twjit;