summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-05-06 18:22:18 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-05-08 18:03:04 +0900
commit61b6f226e8b5067bf2bc38ea36a4540e45371702 (patch)
tree70e3dd0bf9050652cb435a81ff7ee70e81c70db0
parent1f2a9dc2a912118e77ec9f01e9ad4002ccde52b5 (diff)
[ruby/json] Constify static data in fpconv.c
https://github.com/ruby/json/commit/3b605d9b1e
-rw-r--r--ext/json/vendor/fpconv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/json/vendor/fpconv.c b/ext/json/vendor/fpconv.c
index 2887c64885..854cae288c 100644
--- a/ext/json/vendor/fpconv.c
+++ b/ext/json/vendor/fpconv.c
@@ -41,7 +41,7 @@ typedef struct Fp {
int exp;
} Fp;
-static Fp powers_ten[] = {
+static const Fp powers_ten[] = {
{ 18054884314459144840U, -1220 }, { 13451937075301367670U, -1193 },
{ 10022474136428063862U, -1166 }, { 14934650266808366570U, -1140 },
{ 11127181549972568877U, -1113 }, { 16580792590934885855U, -1087 },
@@ -123,7 +123,7 @@ static Fp find_cachedpow10(int exp, int* k)
#define absv(n) ((n) < 0 ? -(n) : (n))
#define minv(a, b) ((a) < (b) ? (a) : (b))
-static uint64_t tens[] = {
+static const uint64_t tens[] = {
10000000000000000000U, 1000000000000000000U, 100000000000000000U,
10000000000000000U, 1000000000000000U, 100000000000000U,
10000000000000U, 1000000000000U, 100000000000U,
@@ -244,7 +244,7 @@ static int generate_digits(Fp* fp, Fp* upper, Fp* lower, char* digits, int* K)
uint64_t part2 = upper->frac & (one.frac - 1);
int idx = 0, kappa = 10;
- uint64_t* divp;
+ const uint64_t* divp;
/* 1000000000 */
for(divp = tens + 10; kappa > 0; divp++) {
@@ -268,7 +268,7 @@ static int generate_digits(Fp* fp, Fp* upper, Fp* lower, char* digits, int* K)
}
/* 10 */
- uint64_t* unit = tens + 18;
+ const uint64_t* unit = tens + 18;
while(true) {
part2 *= 10;