From e39b93b86e0e5c6da6865b1dae3e099ef3d4eae3 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 9 Jun 2008 05:42:04 +0000 Subject: [PATCH] * complex.c (make_patterns): constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- complex.c | 10 ++++++---- rational.c | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/complex.c b/complex.c index 7b387b94db..16bf8f05b4 100644 --- a/complex.c +++ b/complex.c @@ -1138,10 +1138,12 @@ static VALUE comp_pat1, comp_pat2, a_slash, a_dot_and_an_e, static void make_patterns(void) { - static char comp_pat1_source[] = PATTERN1; - static char comp_pat2_source[] = PATTERN2; - static char image_garbages_pat_source[] = "[+\\(\\)iIjJ]"; - static char underscores_pat_source[] = "_+"; + static const char comp_pat1_source[] = PATTERN1; + static const char comp_pat2_source[] = PATTERN2; + static const char image_garbages_pat_source[] = "[+\\(\\)iIjJ]"; + static const char underscores_pat_source[] = "_+"; + + if (comp_pat1) return; comp_pat1 = rb_reg_new(comp_pat1_source, sizeof comp_pat1_source - 1, 0); rb_global_variable(&comp_pat1); diff --git a/rational.c b/rational.c index dc29aa1628..aaf1d3a8cc 100644 --- a/rational.c +++ b/rational.c @@ -1287,10 +1287,10 @@ static VALUE rat_pat, an_e_pat, a_dot_pat, underscores_pat, an_underscore; static void make_patterns(void) { - static char const rat_pat_source[] = PATTERN; - static char const an_e_pat_source[] = "[eE]"; - static char const a_dot_pat_source[] = "\\."; - static char const underscores_pat_source[] = "_+"; + static const char rat_pat_source[] = PATTERN; + static const char an_e_pat_source[] = "[eE]"; + static const char a_dot_pat_source[] = "\\."; + static const char underscores_pat_source[] = "_+"; if (rat_pat) return;