changeset 533:3a617e4e9b27

libgsmfr2: add const words with struct sizes
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 19 Sep 2024 21:58:10 +0000
parents 5a3535470c95
children 516e84085a15
files libgsmfr2/ed_state.c libgsmfr2/full_dec.c libgsmfr2/pp_state.c libgsmfr2/tw_gsmfr.h
diffstat 4 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmfr2/ed_state.c	Thu Sep 19 21:00:18 2024 +0000
+++ b/libgsmfr2/ed_state.c	Thu Sep 19 21:58:10 2024 +0000
@@ -11,6 +11,8 @@
 #include "typedef.h"
 #include "ed_state.h"
 
+const unsigned gsmfr_0610_state_size = sizeof(struct gsmfr_0610_state);
+
 struct gsmfr_0610_state *gsmfr_0610_create(void)
 {
 	struct gsmfr_0610_state *st;
--- a/libgsmfr2/full_dec.c	Thu Sep 19 21:00:18 2024 +0000
+++ b/libgsmfr2/full_dec.c	Thu Sep 19 21:58:10 2024 +0000
@@ -19,6 +19,8 @@
 	int	is_homed;
 };
 
+const unsigned gsmfr_fulldec_state_size = sizeof(struct gsmfr_fulldec_state);
+
 struct gsmfr_fulldec_state *gsmfr_fulldec_create(void)
 {
 	struct gsmfr_fulldec_state *st;
--- a/libgsmfr2/pp_state.c	Thu Sep 19 21:00:18 2024 +0000
+++ b/libgsmfr2/pp_state.c	Thu Sep 19 21:58:10 2024 +0000
@@ -9,6 +9,8 @@
 #include "tw_gsmfr.h"
 #include "pp_state.h"
 
+const unsigned gsmfr_preproc_state_size = sizeof(struct gsmfr_preproc_state);
+
 struct gsmfr_preproc_state *gsmfr_preproc_create(void)
 {
 	struct gsmfr_preproc_state *st;
--- a/libgsmfr2/tw_gsmfr.h	Thu Sep 19 21:00:18 2024 +0000
+++ b/libgsmfr2/tw_gsmfr.h	Thu Sep 19 21:58:10 2024 +0000
@@ -134,4 +134,10 @@
 			uint8_t *frame_out);
 int gsmfr_tfo_xfrm_dtxd(struct gsmfr_preproc_state *state, uint8_t *frame_out);
 
+/* sizes of state structures, to support alternative malloc schemes */
+
+extern const unsigned gsmfr_0610_state_size;
+extern const unsigned gsmfr_preproc_state_size;
+extern const unsigned gsmfr_fulldec_state_size;
+
 #endif	/* include guard */