1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@17765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-07-01 08:21:44 +00:00
parent 6f88631baa
commit 4f572663c8
9 changed files with 66 additions and 54 deletions

View file

@ -1,3 +1,12 @@
Tue Jul 1 17:21:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* regexec.c (stack_double): use MatchStackLimitSize atomically.
* regparse.c (onig_free_shared_cclass_table): OnigTypeCClassTable
needs atomicity
* regsyntax.c: constified all predefined OnigSyntaxTypes.
Tue Jul 1 16:57:44 2008 URABE Shyouhei <shyouhei@ruby-lang.org> Tue Jul 1 16:57:44 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
* include/ruby/st.h (struct st_table): type of bit-field * include/ruby/st.h (struct st_table): type of bit-field

View file

@ -364,16 +364,16 @@ typedef struct {
OnigMetaCharTableType meta_char_table; OnigMetaCharTableType meta_char_table;
} OnigSyntaxType; } OnigSyntaxType;
ONIG_EXTERN OnigSyntaxType OnigSyntaxASIS; ONIG_EXTERN const OnigSyntaxType OnigSyntaxASIS;
ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic; ONIG_EXTERN const OnigSyntaxType OnigSyntaxPosixBasic;
ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended; ONIG_EXTERN const OnigSyntaxType OnigSyntaxPosixExtended;
ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs; ONIG_EXTERN const OnigSyntaxType OnigSyntaxEmacs;
ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep; ONIG_EXTERN const OnigSyntaxType OnigSyntaxGrep;
ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex; ONIG_EXTERN const OnigSyntaxType OnigSyntaxGnuRegex;
ONIG_EXTERN OnigSyntaxType OnigSyntaxJava; ONIG_EXTERN const OnigSyntaxType OnigSyntaxJava;
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl; ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl;
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl_NG; ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl_NG;
ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby; ONIG_EXTERN const OnigSyntaxType OnigSyntaxRuby;
/* predefined syntaxes (see regsyntax.c) */ /* predefined syntaxes (see regsyntax.c) */
#define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS) #define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS)
@ -388,7 +388,7 @@ ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby) #define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
/* default syntax */ /* default syntax */
ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax; ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
#define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax #define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax
/* syntax (operators) */ /* syntax (operators) */
@ -634,7 +634,7 @@ typedef struct re_pattern_buffer {
OnigEncoding enc; OnigEncoding enc;
OnigOptionType options; OnigOptionType options;
OnigSyntaxType* syntax; const OnigSyntaxType* syntax;
OnigCaseFoldType case_fold_flag; OnigCaseFoldType case_fold_flag;
void* name_table; void* name_table;
@ -683,7 +683,7 @@ void onig_set_warn_func P_((OnigWarnFunc f));
ONIG_EXTERN ONIG_EXTERN
void onig_set_verb_warn_func P_((OnigWarnFunc f)); void onig_set_verb_warn_func P_((OnigWarnFunc f));
ONIG_EXTERN ONIG_EXTERN
int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo));
ONIG_EXTERN ONIG_EXTERN
int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo)); int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
ONIG_EXTERN ONIG_EXTERN
@ -735,11 +735,11 @@ OnigOptionType onig_get_options P_((OnigRegex reg));
ONIG_EXTERN ONIG_EXTERN
OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg)); OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg));
ONIG_EXTERN ONIG_EXTERN
OnigSyntaxType* onig_get_syntax P_((OnigRegex reg)); const OnigSyntaxType* onig_get_syntax P_((OnigRegex reg));
ONIG_EXTERN ONIG_EXTERN
int onig_set_default_syntax P_((OnigSyntaxType* syntax)); int onig_set_default_syntax P_((const OnigSyntaxType* syntax));
ONIG_EXTERN ONIG_EXTERN
void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from)); void onig_copy_syntax P_((OnigSyntaxType* to, const OnigSyntaxType* from));
ONIG_EXTERN ONIG_EXTERN
unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax)); unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax));
ONIG_EXTERN ONIG_EXTERN

View file

@ -4380,7 +4380,7 @@ add_char_amb_opt_map_info(OptMapInfo* map, UChar* p, UChar* end,
static void static void
select_opt_map_info(OptMapInfo* now, OptMapInfo* alt) select_opt_map_info(OptMapInfo* now, OptMapInfo* alt)
{ {
static int z = 1<<15; /* 32768: something big value */ const int z = 1<<15; /* 32768: something big value */
int v1, v2; int v1, v2;
@ -5547,7 +5547,7 @@ static int onig_inited = 0;
extern int extern int
onig_alloc_init(regex_t** reg, OnigOptionType option, onig_alloc_init(regex_t** reg, OnigOptionType option,
OnigCaseFoldType case_fold_flag, OnigCaseFoldType case_fold_flag,
OnigEncoding enc, OnigSyntaxType* syntax) OnigEncoding enc, const OnigSyntaxType* syntax)
{ {
if (! onig_inited) if (! onig_inited)
onig_init(); onig_init();
@ -5591,7 +5591,7 @@ onig_alloc_init(regex_t** reg, OnigOptionType option,
extern int extern int
onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end, onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax,
OnigErrorInfo* einfo) OnigErrorInfo* einfo)
{ {
int r; int r;

View file

@ -451,7 +451,7 @@ static int
ss_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED, ss_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigApplyAllCaseFoldFunc f, void* arg) OnigApplyAllCaseFoldFunc f, void* arg)
{ {
static OnigCodePoint ss[] = { 0x73, 0x73 }; OnigCodePoint ss[] = { 0x73, 0x73 };
return (*f)((OnigCodePoint )0xdf, ss, 2, arg); return (*f)((OnigCodePoint )0xdf, ss, 2, arg);
} }
@ -783,7 +783,7 @@ onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
extern int extern int
onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end) onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{ {
static PosixBracketEntryType PBS[] = { static const PosixBracketEntryType PBS[] = {
{ (UChar* )"Alnum", ONIGENC_CTYPE_ALNUM, 5 }, { (UChar* )"Alnum", ONIGENC_CTYPE_ALNUM, 5 },
{ (UChar* )"Alpha", ONIGENC_CTYPE_ALPHA, 5 }, { (UChar* )"Alpha", ONIGENC_CTYPE_ALPHA, 5 },
{ (UChar* )"Blank", ONIGENC_CTYPE_BLANK, 5 }, { (UChar* )"Blank", ONIGENC_CTYPE_BLANK, 5 },
@ -801,7 +801,7 @@ onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{ (UChar* )NULL, -1, 0 } { (UChar* )NULL, -1, 0 }
}; };
PosixBracketEntryType *pb; const PosixBracketEntryType *pb;
int len; int len;
len = onigenc_strlen(enc, p, end); len = onigenc_strlen(enc, p, end);

View file

@ -454,12 +454,13 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
n *= 2; n *= 2;
} }
else { else {
unsigned int limit_size = MatchStackLimitSize;
n *= 2; n *= 2;
if (MatchStackLimitSize != 0 && n > MatchStackLimitSize) { if (limit_size != 0 && n > limit_size) {
if ((unsigned int )(stk_end - stk_base) == MatchStackLimitSize) if ((unsigned int )(stk_end - stk_base) == limit_size)
return ONIGERR_MATCH_STACK_LIMIT_OVER; return ONIGERR_MATCH_STACK_LIMIT_OVER;
else else
n = MatchStackLimitSize; n = limit_size;
} }
x = (OnigStackType* )xrealloc(stk_base, sizeof(OnigStackType) * n); x = (OnigStackType* )xrealloc(stk_base, sizeof(OnigStackType) * n);
if (IS_NULL(x)) { if (IS_NULL(x)) {
@ -1249,7 +1250,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#endif #endif
const UChar* sstart, UChar* sprev, OnigMatchArg* msa) const UChar* sstart, UChar* sprev, OnigMatchArg* msa)
{ {
static UChar FinishCode[] = { OP_FINISH }; static const UChar FinishCode[] = { OP_FINISH };
int i, n, num_mem, best_len, pop_level; int i, n, num_mem, best_len, pop_level;
LengthType tlen, tlen2; LengthType tlen, tlen2;
@ -1295,7 +1296,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
(int )(end - str), (int )(sstart - str)); (int )(end - str), (int )(sstart - str));
#endif #endif
STACK_PUSH_ENSURED(STK_ALT, FinishCode); /* bottom stack */ STACK_PUSH_ENSURED(STK_ALT, (UChar *)FinishCode); /* bottom stack */
best_len = ONIG_MISMATCH; best_len = ONIG_MISMATCH;
s = (UChar* )sstart; s = (UChar* )sstart;
while (1) { while (1) {
@ -3555,7 +3556,7 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
} }
} }
else if (str == end) { /* empty string */ else if (str == end) { /* empty string */
static const UChar* address_for_empty_string = (UChar* )""; static const UChar address_for_empty_string[] = "";
#ifdef ONIG_DEBUG_SEARCH #ifdef ONIG_DEBUG_SEARCH
fprintf(stderr, "onig_search: empty string.\n"); fprintf(stderr, "onig_search: empty string.\n");
@ -3785,7 +3786,7 @@ onig_get_case_fold_flag(regex_t* reg)
return reg->case_fold_flag; return reg->case_fold_flag;
} }
extern OnigSyntaxType* extern const OnigSyntaxType*
onig_get_syntax(regex_t* reg) onig_get_syntax(regex_t* reg)
{ {
return reg->syntax; return reg->syntax;

View file

@ -802,7 +802,7 @@ extern void onig_print_statistics P_((FILE* f));
extern UChar* onig_error_code_to_format P_((int code)); extern UChar* onig_error_code_to_format P_((int code));
extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...)); extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
extern int onig_bbuf_init P_((BBuf* buf, int size)); extern int onig_bbuf_init P_((BBuf* buf, int size));
extern int onig_alloc_init P_((regex_t** reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax)); extern int onig_alloc_init P_((regex_t** reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax));
extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo)); extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo));
extern void onig_chain_reduce P_((regex_t* reg)); extern void onig_chain_reduce P_((regex_t* reg));
extern void onig_chain_link_add P_((regex_t* to, regex_t* add)); extern void onig_chain_link_add P_((regex_t* to, regex_t* add));

View file

@ -34,7 +34,7 @@
#define CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS #define CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS
OnigSyntaxType OnigSyntaxRuby = { const OnigSyntaxType OnigSyntaxRuby = {
(( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | (( 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_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS | 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) { } 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* extern hash_table_type*
onig_st_init_strend_table_with_size(int size) 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_cmp,
str_end_hash, str_end_hash,
}; };
@ -2177,7 +2177,7 @@ enum ReduceType {
RQ_PQ_Q /* to '+?)?' */ 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_A, RQ_A, RQ_QQ, RQ_AQ, RQ_ASIS}, /* '?' */
{RQ_DEL, RQ_DEL, RQ_DEL, RQ_P_QQ, RQ_P_QQ, RQ_DEL}, /* '*' */ {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}, /* '+' */ {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 static int
str_exist_check_with_esc(OnigCodePoint s[], int n, UChar* from, UChar* to, 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; int i, in_esc;
OnigCodePoint x; OnigCodePoint x;
@ -2903,7 +2903,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
{ {
int num; int num;
OnigCodePoint c, c2; OnigCodePoint c, c2;
OnigSyntaxType* syn = env->syntax; const OnigSyntaxType* syn = env->syntax;
OnigEncoding enc = env->enc; OnigEncoding enc = env->enc;
UChar* prev; UChar* prev;
UChar* p = *src; UChar* p = *src;
@ -3122,7 +3122,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
int r, num; int r, num;
OnigCodePoint c; OnigCodePoint c;
OnigEncoding enc = env->enc; OnigEncoding enc = env->enc;
OnigSyntaxType* syn = env->syntax; const OnigSyntaxType* syn = env->syntax;
UChar* prev; UChar* prev;
UChar* p = *src; UChar* p = *src;
PFETCH_READY; 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_CHECK_LIMIT_LENGTH 20
#define POSIX_BRACKET_NAME_MIN_LEN 4 #define POSIX_BRACKET_NAME_MIN_LEN 4
static PosixBracketEntryType PBS[] = { static const PosixBracketEntryType PBS[] = {
{ (UChar* )"alnum", ONIGENC_CTYPE_ALNUM, 5 }, { (UChar* )"alnum", ONIGENC_CTYPE_ALNUM, 5 },
{ (UChar* )"alpha", ONIGENC_CTYPE_ALPHA, 5 }, { (UChar* )"alpha", ONIGENC_CTYPE_ALPHA, 5 },
{ (UChar* )"blank", ONIGENC_CTYPE_BLANK, 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 } { (UChar* )NULL, -1, 0 }
}; };
PosixBracketEntryType *pb; const PosixBracketEntryType *pb;
int not, i, r; int not, i, r;
OnigCodePoint c; OnigCodePoint c;
OnigEncoding enc = env->enc; OnigEncoding enc = env->enc;
@ -4742,11 +4742,11 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
return 0; return 0;
} }
static const char* PopularQStr[] = { static const char* const PopularQStr[] = {
"?", "*", "+", "??", "*?", "+?" "?", "*", "+", "??", "*?", "+?"
}; };
static const char* ReduceQStr[] = { static const char* const ReduceQStr[] = {
"", "", "*", "*?", "??", "+ and ??", "+? and ?" "", "", "*", "*?", "??", "+ and ??", "+? and ?"
}; };
@ -4882,7 +4882,7 @@ static int type_cclass_hash(type_cclass_key* key)
return val + (val >> 5); 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_cmp,
type_cclass_hash, type_cclass_hash,
}; };
@ -4906,11 +4906,13 @@ i_free_shared_class(type_cclass_key* key, Node* node, void* arg ARG_UNUSED)
extern int extern int
onig_free_shared_cclass_table(void) onig_free_shared_cclass_table(void)
{ {
THREAD_ATOMIC_START;
if (IS_NOT_NULL(OnigTypeCClassTable)) { if (IS_NOT_NULL(OnigTypeCClassTable)) {
onig_st_foreach(OnigTypeCClassTable, i_free_shared_class, 0); onig_st_foreach(OnigTypeCClassTable, i_free_shared_class, 0);
onig_st_free_table(OnigTypeCClassTable); onig_st_free_table(OnigTypeCClassTable);
OnigTypeCClassTable = NULL; OnigTypeCClassTable = NULL;
} }
THREAD_ATOMIC_END;
return 0; return 0;
} }

View file

@ -279,7 +279,7 @@ typedef struct {
OnigOptionType option; OnigOptionType option;
OnigCaseFoldType case_fold_flag; OnigCaseFoldType case_fold_flag;
OnigEncoding enc; OnigEncoding enc;
OnigSyntaxType* syntax; const OnigSyntaxType* syntax;
BitStatusType capture_history; BitStatusType capture_history;
BitStatusType bt_mem_start; BitStatusType bt_mem_start;
BitStatusType bt_mem_end; BitStatusType bt_mem_end;

View file

@ -29,7 +29,7 @@
#include "regint.h" #include "regint.h"
OnigSyntaxType OnigSyntaxASIS = { const OnigSyntaxType OnigSyntaxASIS = {
0 0
, ONIG_SYN_OP2_INEFFECTIVE_ESCAPE , ONIG_SYN_OP2_INEFFECTIVE_ESCAPE
, 0 , 0
@ -45,7 +45,7 @@ OnigSyntaxType OnigSyntaxASIS = {
} }
}; };
OnigSyntaxType OnigSyntaxPosixBasic = { const OnigSyntaxType OnigSyntaxPosixBasic = {
( SYN_POSIX_COMMON_OP | ONIG_SYN_OP_ESC_LPAREN_SUBEXP | ( SYN_POSIX_COMMON_OP | ONIG_SYN_OP_ESC_LPAREN_SUBEXP |
ONIG_SYN_OP_ESC_BRACE_INTERVAL ) ONIG_SYN_OP_ESC_BRACE_INTERVAL )
, 0 , 0
@ -62,7 +62,7 @@ OnigSyntaxType OnigSyntaxPosixBasic = {
} }
}; };
OnigSyntaxType OnigSyntaxPosixExtended = { const OnigSyntaxType OnigSyntaxPosixExtended = {
( SYN_POSIX_COMMON_OP | ONIG_SYN_OP_LPAREN_SUBEXP | ( SYN_POSIX_COMMON_OP | ONIG_SYN_OP_LPAREN_SUBEXP |
ONIG_SYN_OP_BRACE_INTERVAL | ONIG_SYN_OP_BRACE_INTERVAL |
ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_VBAR_ALT ) ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_VBAR_ALT )
@ -83,7 +83,7 @@ OnigSyntaxType OnigSyntaxPosixExtended = {
} }
}; };
OnigSyntaxType OnigSyntaxEmacs = { const OnigSyntaxType OnigSyntaxEmacs = {
( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC |
ONIG_SYN_OP_ESC_BRACE_INTERVAL | ONIG_SYN_OP_ESC_BRACE_INTERVAL |
ONIG_SYN_OP_ESC_LPAREN_SUBEXP | ONIG_SYN_OP_ESC_VBAR_ALT | ONIG_SYN_OP_ESC_LPAREN_SUBEXP | ONIG_SYN_OP_ESC_VBAR_ALT |
@ -104,7 +104,7 @@ OnigSyntaxType OnigSyntaxEmacs = {
} }
}; };
OnigSyntaxType OnigSyntaxGrep = { const OnigSyntaxType OnigSyntaxGrep = {
( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_POSIX_BRACKET | ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_POSIX_BRACKET |
ONIG_SYN_OP_ESC_BRACE_INTERVAL | ONIG_SYN_OP_ESC_LPAREN_SUBEXP | ONIG_SYN_OP_ESC_BRACE_INTERVAL | ONIG_SYN_OP_ESC_LPAREN_SUBEXP |
ONIG_SYN_OP_ESC_VBAR_ALT | ONIG_SYN_OP_ESC_VBAR_ALT |
@ -126,7 +126,7 @@ OnigSyntaxType OnigSyntaxGrep = {
} }
}; };
OnigSyntaxType OnigSyntaxGnuRegex = { const OnigSyntaxType OnigSyntaxGnuRegex = {
SYN_GNU_REGEX_OP SYN_GNU_REGEX_OP
, 0 , 0
, SYN_GNU_REGEX_BV , SYN_GNU_REGEX_BV
@ -142,7 +142,7 @@ OnigSyntaxType OnigSyntaxGnuRegex = {
} }
}; };
OnigSyntaxType OnigSyntaxJava = { const OnigSyntaxType OnigSyntaxJava = {
(( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL |
ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 ) ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 )
@ -165,7 +165,7 @@ OnigSyntaxType OnigSyntaxJava = {
} }
}; };
OnigSyntaxType OnigSyntaxPerl = { const OnigSyntaxType OnigSyntaxPerl = {
(( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | (( 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_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
@ -189,7 +189,7 @@ OnigSyntaxType OnigSyntaxPerl = {
}; };
/* Perl + named group */ /* Perl + named group */
OnigSyntaxType OnigSyntaxPerl_NG = { const OnigSyntaxType OnigSyntaxPerl_NG = {
(( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | (( 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_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
@ -220,7 +220,7 @@ OnigSyntaxType OnigSyntaxPerl_NG = {
extern int extern int
onig_set_default_syntax(OnigSyntaxType* syntax) onig_set_default_syntax(const OnigSyntaxType* syntax)
{ {
if (IS_NULL(syntax)) if (IS_NULL(syntax))
syntax = ONIG_SYNTAX_RUBY; syntax = ONIG_SYNTAX_RUBY;
@ -230,7 +230,7 @@ onig_set_default_syntax(OnigSyntaxType* syntax)
} }
extern void extern void
onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from) onig_copy_syntax(OnigSyntaxType* to, const OnigSyntaxType* from)
{ {
*to = *from; *to = *from;
} }