summaryrefslogtreecommitdiffstats
path: root/regparse.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-01 08:21:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-01 08:21:44 +0000
commita7bb3d4d983b1cd2e1d529d8bec909dd7e313c94 (patch)
tree9cb8d2dad6a01ce4a7aa1c46cdc772d0015fb72c /regparse.c
parent442211a6239c3801c3dcf9a904a156f93ffaf166 (diff)
downloadruby-a7bb3d4d983b1cd2e1d529d8bec909dd7e313c94.tar.gz
ruby-a7bb3d4d983b1cd2e1d529d8bec909dd7e313c94.tar.xz
ruby-a7bb3d4d983b1cd2e1d529d8bec909dd7e313c94.zip
* regexec.c (stack_double): use MatchStackLimitSize atomically.
* regparse.c (onig_free_shared_cclass_table): OnigTypeCClassTable needs atomicity * regsyntax.c: constified all predefined OnigSyntaxTypes. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regparse.c')
-rw-r--r--regparse.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/regparse.c b/regparse.c
index 8d74efafe..4a5e861fd 100644
--- a/regparse.c
+++ b/regparse.c
@@ -34,7 +34,7 @@
#define CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS
-OnigSyntaxType OnigSyntaxRuby = {
+const OnigSyntaxType OnigSyntaxRuby = {
(( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
@@ -70,7 +70,7 @@ OnigSyntaxType OnigSyntaxRuby = {
}
};
-OnigSyntaxType* OnigDefaultSyntax = ONIG_SYNTAX_RUBY;
+const OnigSyntaxType* OnigDefaultSyntax = ONIG_SYNTAX_RUBY;
extern void onig_null_warn(const char* s ARG_UNUSED) { }
@@ -342,7 +342,7 @@ str_end_hash(st_str_end_key* x)
extern hash_table_type*
onig_st_init_strend_table_with_size(int size)
{
- static struct st_hash_type hashType = {
+ static const struct st_hash_type hashType = {
str_end_cmp,
str_end_hash,
};
@@ -2177,7 +2177,7 @@ enum ReduceType {
RQ_PQ_Q /* to '+?)?' */
};
-static enum ReduceType ReduceTypeTable[6][6] = {
+static enum ReduceType const ReduceTypeTable[6][6] = {
{RQ_DEL, RQ_A, RQ_A, RQ_QQ, RQ_AQ, RQ_ASIS}, /* '?' */
{RQ_DEL, RQ_DEL, RQ_DEL, RQ_P_QQ, RQ_P_QQ, RQ_DEL}, /* '*' */
{RQ_A, RQ_A, RQ_DEL, RQ_ASIS, RQ_P_QQ, RQ_DEL}, /* '+' */
@@ -2862,7 +2862,7 @@ find_str_position(OnigCodePoint s[], int n, UChar* from, UChar* to,
static int
str_exist_check_with_esc(OnigCodePoint s[], int n, UChar* from, UChar* to,
- OnigCodePoint bad, OnigEncoding enc, OnigSyntaxType* syn)
+ OnigCodePoint bad, OnigEncoding enc, const OnigSyntaxType* syn)
{
int i, in_esc;
OnigCodePoint x;
@@ -2903,7 +2903,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
{
int num;
OnigCodePoint c, c2;
- OnigSyntaxType* syn = env->syntax;
+ const OnigSyntaxType* syn = env->syntax;
OnigEncoding enc = env->enc;
UChar* prev;
UChar* p = *src;
@@ -3122,7 +3122,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
int r, num;
OnigCodePoint c;
OnigEncoding enc = env->enc;
- OnigSyntaxType* syn = env->syntax;
+ const OnigSyntaxType* syn = env->syntax;
UChar* prev;
UChar* p = *src;
PFETCH_READY;
@@ -3911,7 +3911,7 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env)
#define POSIX_BRACKET_CHECK_LIMIT_LENGTH 20
#define POSIX_BRACKET_NAME_MIN_LEN 4
- static PosixBracketEntryType PBS[] = {
+ static const PosixBracketEntryType PBS[] = {
{ (UChar* )"alnum", ONIGENC_CTYPE_ALNUM, 5 },
{ (UChar* )"alpha", ONIGENC_CTYPE_ALPHA, 5 },
{ (UChar* )"blank", ONIGENC_CTYPE_BLANK, 5 },
@@ -3929,7 +3929,7 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env)
{ (UChar* )NULL, -1, 0 }
};
- PosixBracketEntryType *pb;
+ const PosixBracketEntryType *pb;
int not, i, r;
OnigCodePoint c;
OnigEncoding enc = env->enc;
@@ -4742,11 +4742,11 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
return 0;
}
-static const char* PopularQStr[] = {
+static const char* const PopularQStr[] = {
"?", "*", "+", "??", "*?", "+?"
};
-static const char* ReduceQStr[] = {
+static const char* const ReduceQStr[] = {
"", "", "*", "*?", "??", "+ and ??", "+? and ?"
};
@@ -4882,7 +4882,7 @@ static int type_cclass_hash(type_cclass_key* key)
return val + (val >> 5);
}
-static struct st_hash_type type_type_cclass_hash = {
+static const struct st_hash_type type_type_cclass_hash = {
type_cclass_cmp,
type_cclass_hash,
};
@@ -4906,11 +4906,13 @@ i_free_shared_class(type_cclass_key* key, Node* node, void* arg ARG_UNUSED)
extern int
onig_free_shared_cclass_table(void)
{
+ THREAD_ATOMIC_START;
if (IS_NOT_NULL(OnigTypeCClassTable)) {
onig_st_foreach(OnigTypeCClassTable, i_free_shared_class, 0);
onig_st_free_table(OnigTypeCClassTable);
OnigTypeCClassTable = NULL;
}
+ THREAD_ATOMIC_END;
return 0;
}