Commit 17ecbaa2 authored by Santa Zhang's avatar Santa Zhang Committed by Yukihiro "Matz" Matsumoto

add a few const qualifier

parent b443bd08
...@@ -91,7 +91,7 @@ typedef short mrb_sym; ...@@ -91,7 +91,7 @@ typedef short mrb_sym;
# define PRIo64 "I64o" # define PRIo64 "I64o"
# define PRIx64 "I64x" # define PRIx64 "I64x"
# define PRIX64 "I64X" # define PRIX64 "I64X"
static unsigned int IEEE754_INFINITY_BITS_SINGLE = 0x7F800000; static const unsigned int IEEE754_INFINITY_BITS_SINGLE = 0x7F800000;
# define INFINITY (*(float *)&IEEE754_INFINITY_BITS_SINGLE) # define INFINITY (*(float *)&IEEE754_INFINITY_BITS_SINGLE)
# define NAN ((float)(INFINITY - INFINITY)) # define NAN ((float)(INFINITY - INFINITY))
# else # else
......
...@@ -32,7 +32,7 @@ void mrb_random_init_genrand(mt_state *t, unsigned long s) ...@@ -32,7 +32,7 @@ void mrb_random_init_genrand(mt_state *t, unsigned long s)
unsigned long mrb_random_genrand_int32(mt_state *t) unsigned long mrb_random_genrand_int32(mt_state *t)
{ {
unsigned long y; unsigned long y;
static unsigned long mag01[2]={0x0UL, MATRIX_A}; static const unsigned long mag01[2]={0x0UL, MATRIX_A};
/* mag01[x] = x * MATRIX_A for x=0,1 */ /* mag01[x] = x * MATRIX_A for x=0,1 */
if (t->mti >= N) { /* generate N words at one time */ if (t->mti >= N) { /* generate N words at one time */
...@@ -126,7 +126,7 @@ void init_by_array(unsigned long init_key[], int key_length) ...@@ -126,7 +126,7 @@ void init_by_array(unsigned long init_key[], int key_length)
unsigned long genrand_int32(void) unsigned long genrand_int32(void)
{ {
unsigned long y; unsigned long y;
static unsigned long mag01[2]={0x0UL, MATRIX_A}; static const unsigned long mag01[2]={0x0UL, MATRIX_A};
/* mag01[x] = x * MATRIX_A for x=0,1 */ /* mag01[x] = x * MATRIX_A for x=0,1 */
if (mti >= N) { /* generate N words at one time */ if (mti >= N) { /* generate N words at one time */
......
...@@ -19,7 +19,7 @@ static const char utf8len_codepage[256] = ...@@ -19,7 +19,7 @@ static const char utf8len_codepage[256] =
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1,
}; };
static char utf8len_codepage_zero[256] = static const char utf8len_codepage_zero[256] =
{ {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment