Skip to content

Commit 922f24f

Browse files
authored
Merge pull request #799 from nobu/fpconv-constify
Constify static data in fpconv.c
2 parents 4a9564f + 3b605d9 commit 922f24f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/json/ext/vendor/fpconv.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ typedef struct Fp {
4141
int exp;
4242
} Fp;
4343

44-
static Fp powers_ten[] = {
44+
static const Fp powers_ten[] = {
4545
{ 18054884314459144840U, -1220 }, { 13451937075301367670U, -1193 },
4646
{ 10022474136428063862U, -1166 }, { 14934650266808366570U, -1140 },
4747
{ 11127181549972568877U, -1113 }, { 16580792590934885855U, -1087 },
@@ -123,7 +123,7 @@ static Fp find_cachedpow10(int exp, int* k)
123123
#define absv(n) ((n) < 0 ? -(n) : (n))
124124
#define minv(a, b) ((a) < (b) ? (a) : (b))
125125

126-
static uint64_t tens[] = {
126+
static const uint64_t tens[] = {
127127
10000000000000000000U, 1000000000000000000U, 100000000000000000U,
128128
10000000000000000U, 1000000000000000U, 100000000000000U,
129129
10000000000000U, 1000000000000U, 100000000000U,
@@ -244,7 +244,7 @@ static int generate_digits(Fp* fp, Fp* upper, Fp* lower, char* digits, int* K)
244244
uint64_t part2 = upper->frac & (one.frac - 1);
245245

246246
int idx = 0, kappa = 10;
247-
uint64_t* divp;
247+
const uint64_t* divp;
248248
/* 1000000000 */
249249
for(divp = tens + 10; kappa > 0; divp++) {
250250

@@ -268,7 +268,7 @@ static int generate_digits(Fp* fp, Fp* upper, Fp* lower, char* digits, int* K)
268268
}
269269

270270
/* 10 */
271-
uint64_t* unit = tens + 18;
271+
const uint64_t* unit = tens + 18;
272272

273273
while(true) {
274274
part2 *= 10;

0 commit comments

Comments
 (0)