blob: 37fc413a9398b5cc59e7cde4033433887f0192b8 [file] [log] [blame]
Sylvain Munaut5e2e0442015-12-30 11:45:58 +01001From 8344eeb802a60a52bde844e4cf0ee81cffc9c329 Mon Sep 17 00:00:00 2001
2From: Sylvain Munaut <tnt@246tNt.com>
3Date: Wed, 30 Dec 2015 09:56:12 +0100
4Subject: [PATCH 4/6] Make sure all constants are marked as such
5
6This removes 'static' and moves stuff from .data to .rodata
7
8Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
9---
10 dtx.c | 4 ++--
11 homing.c | 4 ++--
12 sp_dec.c | 22 ++++++++++++----------
13 sp_dec.h | 8 ++++----
14 sp_enc.c | 8 ++++----
15 sp_frm.c | 10 +++++-----
16 sp_frm.h | 4 ++--
17 sp_rom.c | 2 +-
18 sp_rom.h | 2 +-
19 sp_sfrm.c | 7 +++----
20 typedefs.h | 4 ++--
21 11 files changed, 38 insertions(+), 37 deletions(-)
22
23diff --git refsrc/dtx.c refsrc/dtx.c
24index 27dcb0d..918dc88 100644
25--- refsrc/dtx.c
26+++ refsrc/dtx.c
27@@ -103 +103 @@
28-Shortword psrCNNewFactor[12] = {0x0aaa, 0x1554, 0x1ffe, 0x2aa8, 0x3552,
29+const Shortword psrCNNewFactor[12] = {0x0aaa, 0x1554, 0x1ffe, 0x2aa8, 0x3552,
30@@ -110 +110 @@
31-LongwordRom ppLr_gsTable[4][32] =
32+const LongwordRom ppLr_gsTable[4][32] =
33diff --git refsrc/homing.c refsrc/homing.c
34index b45ea03..9901ac8 100644
35--- refsrc/homing.c
36+++ refsrc/homing.c
37@@ -120 +120 @@
38- static int n[] = {5, 11, 9, 8, 1, 2, 7, 7, 5, 7, 7, 5, 7, 7, 5, 7, 7, 5};
39+ const int n[] = {5, 11, 9, 8, 1, 2, 7, 7, 5, 7, 7, 5, 7, 7, 5, 7, 7, 5};
40@@ -122 +122 @@
41- static Shortword dhf_mask[] =
42+ const Shortword dhf_mask[] =
43diff --git refsrc/sp_dec.c refsrc/sp_dec.c
44index 07398a7..6022f5a 100644
45--- refsrc/sp_dec.c
46+++ refsrc/sp_dec.c
47@@ -733 +733 @@
48- static ShortwordRom psrSST[NP + 1] = {0x7FFF,
49+ const ShortwordRom psrSST[NP + 1] = {0x7FFF,
50@@ -1477,2 +1477,2 @@
51- Shortword *ppswSynthAs[], Shortword *ppswPFNumAs[],
52- Shortword *ppswPFDenomAs[])
53+ Shortword * const ppswSynthAs[], Shortword * const ppswPFNumAs[],
54+ Shortword * const ppswPFDenomAs[])
55@@ -4621 +4620,0 @@
56- *pswLtpStateOut = &pswLtpStateBaseDec[LTP_LEN],
57@@ -4624,2 +4623,5 @@
58- pswPFDenomAsSpace[NP * N_SUB],
59- *ppswSynthAs[N_SUB] = {
60+ pswPFDenomAsSpace[NP * N_SUB];
61+
62+ static Shortword
63+ * const pswLtpStateOut = &pswLtpStateBaseDec[LTP_LEN],
64+ * const ppswSynthAs[N_SUB] = {
65@@ -4632 +4634 @@
66- *ppswPFNumAs[N_SUB] = {
67+ * const ppswPFNumAs[N_SUB] = {
68@@ -4638 +4640 @@
69- *ppswPFDenomAs[N_SUB] = {
70+ * const ppswPFDenomAs[N_SUB] = {
71@@ -4645 +4647 @@
72- static ShortwordRom
73+ const ShortwordRom
74@@ -5429 +5431 @@
75-void v_con(Shortword pswBVects[], Shortword pswOutVect[],
76+void v_con(const Shortword pswBVects[], Shortword pswOutVect[],
77diff --git refsrc/sp_dec.h refsrc/sp_dec.h
78index b18e3cb..2d3bd71 100644
79--- refsrc/sp_dec.h
80+++ refsrc/sp_dec.h
81@@ -38,3 +38,3 @@
82- Shortword *ppswSynthAs[],
83- Shortword *ppswPFNumAs[],
84- Shortword *ppswPFDenomAs[]);
85+ Shortword * const ppswSynthAs[],
86+ Shortword * const ppswPFNumAs[],
87+ Shortword * const ppswPFDenomAs[]);
88@@ -97 +97 @@
89- void v_con(Shortword pswBVects[], Shortword pswOutVect[],
90+ void v_con(const Shortword pswBVects[], Shortword pswOutVect[],
91diff --git refsrc/sp_enc.c refsrc/sp_enc.c
92index 6dcb985..5f7eeef 100644
93--- refsrc/sp_enc.c
94+++ refsrc/sp_enc.c
95@@ -133 +133 @@
96- static Shortword *pswLpcStart = &pswSpeech[LPCSTARTINDEX];
97+ Shortword * const pswLpcStart = &pswSpeech[LPCSTARTINDEX];
98@@ -136 +136 @@
99- static Shortword *pswNewSpeech = &pswSpeech[NUMSTARTUPSMP];
100+ Shortword * const pswNewSpeech = &pswSpeech[NUMSTARTUPSMP];
101@@ -139 +139 @@
102- static Shortword *pswWgtSpeech = &pswWgtSpeechSpace[LSMAX];
103+ Shortword * const pswWgtSpeech = &pswWgtSpeechSpace[LSMAX];
104@@ -141 +141 @@
105- static struct NormSw *psnsWSfrmEng = &psnsWSfrmEngSpace[N_SUB];
106+ struct NormSw * const psnsWSfrmEng = &psnsWSfrmEngSpace[N_SUB];
107diff --git refsrc/sp_frm.c refsrc/sp_frm.c
108index c4854ad..bb26381 100644
109--- refsrc/sp_frm.c
110+++ refsrc/sp_frm.c
111@@ -2142 +2142 @@
112-void filt4_2nd(Shortword pswCoeff[], Shortword pswIn[],
113+void filt4_2nd(const Shortword pswCoeff[], Shortword pswIn[],
114@@ -3106 +3106 @@
115- static Shortword pswPCoefE[3] =
116+ const Shortword pswPCoefE[3] =
117@@ -3230 +3230 @@
118- static Shortword
119+ const Shortword
120@@ -3938 +3938 @@
121-void iir_d(Shortword pswCoeff[], Shortword pswIn[], Shortword pswXstate[],
122+void iir_d(const Shortword pswCoeff[], Shortword pswIn[], Shortword pswXstate[],
123@@ -5279 +5279 @@
124- static ShortwordRom psrSubMultFactor[] = {0x0aab, /* 1.0/12.0 */
125+ const ShortwordRom psrSubMultFactor[] = {0x0aab, /* 1.0/12.0 */
126diff --git refsrc/sp_frm.h refsrc/sp_frm.h
127index 92317d9..8e2fb14 100644
128--- refsrc/sp_frm.h
129+++ refsrc/sp_frm.h
130@@ -24 +24 @@
131-void iir_d(Shortword pswCoeff[], Shortword pswIn[],
132+void iir_d(const Shortword pswCoeff[], Shortword pswIn[],
133@@ -32 +32 @@
134- void filt4_2nd(Shortword pswCoeff[],
135+ void filt4_2nd(const Shortword pswCoeff[],
136diff --git refsrc/sp_rom.c refsrc/sp_rom.c
137index e666774..f9349d1 100644
138--- refsrc/sp_rom.c
139+++ refsrc/sp_rom.c
140@@ -6416 +6416 @@
141-struct IsubLHn psvqIndex[QUANT_NUM_OF_TABLES] =
142+const struct IsubLHn psvqIndex[QUANT_NUM_OF_TABLES] =
143diff --git refsrc/sp_rom.h refsrc/sp_rom.h
144index 8ac7d91..92a1537 100644
145--- refsrc/sp_rom.h
146+++ refsrc/sp_rom.h
147@@ -128 +128 @@
148-extern struct IsubLHn psvqIndex[QUANT_NUM_OF_TABLES];
149+extern const struct IsubLHn psvqIndex[QUANT_NUM_OF_TABLES];
150diff --git refsrc/sp_sfrm.c refsrc/sp_sfrm.c
151index d4f0cd6..f20837a 100644
152--- refsrc/sp_sfrm.c
153+++ refsrc/sp_sfrm.c
154@@ -1961 +1961 @@
155- static Shortword
156+ const Shortword
157@@ -2054,0 +2055,2 @@
158+ const Shortword *pswBIndex, *pswUIndex, *pswModNextBit;
159+
160@@ -2062,3 +2063,0 @@
161- *pswUIndex,
162- *pswBIndex,
163- *pswModNextBit,
164diff --git refsrc/typedefs.h refsrc/typedefs.h
165index 15200cc..819f999 100644
166--- refsrc/typedefs.h
167+++ refsrc/typedefs.h
168@@ -26,2 +26,2 @@
169-typedef short int ShortwordRom; /* 16 bit ROM data (sr*) */
170-typedef int LongwordRom; /* 32 bit ROM data (L_r*) */
171+typedef const short int ShortwordRom; /* 16 bit ROM data (sr*) */
172+typedef const int LongwordRom; /* 32 bit ROM data (L_r*) */
173--
1742.4.10
175