diff options
| author | Tom Tromey | 2013-07-12 18:44:13 -0600 |
|---|---|---|
| committer | Tom Tromey | 2013-07-12 18:44:13 -0600 |
| commit | b34a529f177a6ea32da5cb1254f91bf9d71838db (patch) | |
| tree | 477131abc15d3107b30b635223d87a22550b480b /src/regex.c | |
| parent | e6f63071a3f7721f55220514b6d9a8ee8c1232d8 (diff) | |
| parent | 5e301d7651c0691bb2bc7f3fbe711fdbe26ac471 (diff) | |
| download | emacs-b34a529f177a6ea32da5cb1254f91bf9d71838db.tar.gz emacs-b34a529f177a6ea32da5cb1254f91bf9d71838db.zip | |
Merge from trunk
Diffstat (limited to 'src/regex.c')
| -rw-r--r-- | src/regex.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/regex.c b/src/regex.c index 73a735cea65..5024f748884 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -531,8 +531,10 @@ init_syntax_once (void) | |||
| 531 | /* Type of source-pattern and string chars. */ | 531 | /* Type of source-pattern and string chars. */ |
| 532 | #ifdef _MSC_VER | 532 | #ifdef _MSC_VER |
| 533 | typedef unsigned char re_char; | 533 | typedef unsigned char re_char; |
| 534 | typedef const re_char const_re_char; | ||
| 534 | #else | 535 | #else |
| 535 | typedef const unsigned char re_char; | 536 | typedef const unsigned char re_char; |
| 537 | typedef re_char const_re_char; | ||
| 536 | #endif | 538 | #endif |
| 537 | 539 | ||
| 538 | typedef char boolean; | 540 | typedef char boolean; |
| @@ -2019,7 +2021,7 @@ struct range_table_work_area | |||
| 2019 | 2021 | ||
| 2020 | /* Map a string to the char class it names (if any). */ | 2022 | /* Map a string to the char class it names (if any). */ |
| 2021 | re_wctype_t | 2023 | re_wctype_t |
| 2022 | re_wctype (const re_char *str) | 2024 | re_wctype (const_re_char *str) |
| 2023 | { | 2025 | { |
| 2024 | const char *string = (const char *) str; | 2026 | const char *string = (const char *) str; |
| 2025 | if (STREQ (string, "alnum")) return RECC_ALNUM; | 2027 | if (STREQ (string, "alnum")) return RECC_ALNUM; |
| @@ -2413,7 +2415,8 @@ do { \ | |||
| 2413 | } while (0) | 2415 | } while (0) |
| 2414 | 2416 | ||
| 2415 | static reg_errcode_t | 2417 | static reg_errcode_t |
| 2416 | regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp) | 2418 | regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax, |
| 2419 | struct re_pattern_buffer *bufp) | ||
| 2417 | { | 2420 | { |
| 2418 | /* We fetch characters from PATTERN here. */ | 2421 | /* We fetch characters from PATTERN here. */ |
| 2419 | register re_wchar_t c, c1; | 2422 | register re_wchar_t c, c1; |
| @@ -3769,7 +3772,7 @@ insert_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2, unsigned cha | |||
| 3769 | least one character before the ^. */ | 3772 | least one character before the ^. */ |
| 3770 | 3773 | ||
| 3771 | static boolean | 3774 | static boolean |
| 3772 | at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax) | 3775 | at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t syntax) |
| 3773 | { | 3776 | { |
| 3774 | re_char *prev = p - 2; | 3777 | re_char *prev = p - 2; |
| 3775 | boolean odd_backslashes; | 3778 | boolean odd_backslashes; |
| @@ -3810,7 +3813,7 @@ at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax) | |||
| 3810 | at least one character after the $, i.e., `P < PEND'. */ | 3813 | at least one character after the $, i.e., `P < PEND'. */ |
| 3811 | 3814 | ||
| 3812 | static boolean | 3815 | static boolean |
| 3813 | at_endline_loc_p (const re_char *p, const re_char *pend, reg_syntax_t syntax) | 3816 | at_endline_loc_p (const_re_char *p, const_re_char *pend, reg_syntax_t syntax) |
| 3814 | { | 3817 | { |
| 3815 | re_char *next = p; | 3818 | re_char *next = p; |
| 3816 | boolean next_backslash = *next == '\\'; | 3819 | boolean next_backslash = *next == '\\'; |
| @@ -3854,7 +3857,8 @@ group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum) | |||
| 3854 | Return -1 if fastmap was not updated accurately. */ | 3857 | Return -1 if fastmap was not updated accurately. */ |
| 3855 | 3858 | ||
| 3856 | static int | 3859 | static int |
| 3857 | analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int multibyte) | 3860 | analyse_first (const_re_char *p, const_re_char *pend, char *fastmap, |
| 3861 | const int multibyte) | ||
| 3858 | { | 3862 | { |
| 3859 | int j, k; | 3863 | int j, k; |
| 3860 | boolean not; | 3864 | boolean not; |
| @@ -4598,7 +4602,7 @@ static int bcmp_translate (re_char *s1, re_char *s2, | |||
| 4598 | /* If the operation is a match against one or more chars, | 4602 | /* If the operation is a match against one or more chars, |
| 4599 | return a pointer to the next operation, else return NULL. */ | 4603 | return a pointer to the next operation, else return NULL. */ |
| 4600 | static re_char * | 4604 | static re_char * |
| 4601 | skip_one_char (const re_char *p) | 4605 | skip_one_char (const_re_char *p) |
| 4602 | { | 4606 | { |
| 4603 | switch (*p++) | 4607 | switch (*p++) |
| 4604 | { | 4608 | { |
| @@ -4640,7 +4644,7 @@ skip_one_char (const re_char *p) | |||
| 4640 | 4644 | ||
| 4641 | /* Jump over non-matching operations. */ | 4645 | /* Jump over non-matching operations. */ |
| 4642 | static re_char * | 4646 | static re_char * |
| 4643 | skip_noops (const re_char *p, const re_char *pend) | 4647 | skip_noops (const_re_char *p, const_re_char *pend) |
| 4644 | { | 4648 | { |
| 4645 | int mcnt; | 4649 | int mcnt; |
| 4646 | while (p < pend) | 4650 | while (p < pend) |
| @@ -4667,7 +4671,8 @@ skip_noops (const re_char *p, const re_char *pend) | |||
| 4667 | 4671 | ||
| 4668 | /* Non-zero if "p1 matches something" implies "p2 fails". */ | 4672 | /* Non-zero if "p1 matches something" implies "p2 fails". */ |
| 4669 | static int | 4673 | static int |
| 4670 | mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const re_char *p2) | 4674 | mutually_exclusive_p (struct re_pattern_buffer *bufp, const_re_char *p1, |
| 4675 | const_re_char *p2) | ||
| 4671 | { | 4676 | { |
| 4672 | re_opcode_t op2; | 4677 | re_opcode_t op2; |
| 4673 | const boolean multibyte = RE_MULTIBYTE_P (bufp); | 4678 | const boolean multibyte = RE_MULTIBYTE_P (bufp); |
| @@ -4920,8 +4925,8 @@ WEAK_ALIAS (__re_match_2, re_match_2) | |||
| 4920 | /* This is a separate function so that we can force an alloca cleanup | 4925 | /* This is a separate function so that we can force an alloca cleanup |
| 4921 | afterwards. */ | 4926 | afterwards. */ |
| 4922 | static regoff_t | 4927 | static regoff_t |
| 4923 | re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, | 4928 | re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, |
| 4924 | size_t size1, const re_char *string2, size_t size2, | 4929 | size_t size1, const_re_char *string2, size_t size2, |
| 4925 | ssize_t pos, struct re_registers *regs, ssize_t stop) | 4930 | ssize_t pos, struct re_registers *regs, ssize_t stop) |
| 4926 | { | 4931 | { |
| 4927 | /* General temporaries. */ | 4932 | /* General temporaries. */ |
| @@ -6263,7 +6268,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, | |||
| 6263 | bytes; nonzero otherwise. */ | 6268 | bytes; nonzero otherwise. */ |
| 6264 | 6269 | ||
| 6265 | static int | 6270 | static int |
| 6266 | bcmp_translate (const re_char *s1, const re_char *s2, register ssize_t len, | 6271 | bcmp_translate (const_re_char *s1, const_re_char *s2, register ssize_t len, |
| 6267 | RE_TRANSLATE_TYPE translate, const int target_multibyte) | 6272 | RE_TRANSLATE_TYPE translate, const int target_multibyte) |
| 6268 | { | 6273 | { |
| 6269 | register re_char *p1 = s1, *p2 = s2; | 6274 | register re_char *p1 = s1, *p2 = s2; |
| @@ -6432,7 +6437,7 @@ re_exec (const char *s) | |||
| 6432 | the return codes and their meanings.) */ | 6437 | the return codes and their meanings.) */ |
| 6433 | 6438 | ||
| 6434 | reg_errcode_t | 6439 | reg_errcode_t |
| 6435 | regcomp (regex_t *__restrict preg, const char *__restrict pattern, | 6440 | regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, |
| 6436 | int cflags) | 6441 | int cflags) |
| 6437 | { | 6442 | { |
| 6438 | reg_errcode_t ret; | 6443 | reg_errcode_t ret; |
| @@ -6513,8 +6518,8 @@ WEAK_ALIAS (__regcomp, regcomp) | |||
| 6513 | We return 0 if we find a match and REG_NOMATCH if not. */ | 6518 | We return 0 if we find a match and REG_NOMATCH if not. */ |
| 6514 | 6519 | ||
| 6515 | reg_errcode_t | 6520 | reg_errcode_t |
| 6516 | regexec (const regex_t *__restrict preg, const char *__restrict string, | 6521 | regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string, |
| 6517 | size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) | 6522 | size_t nmatch, regmatch_t pmatch[_Restrict_arr_], int eflags) |
| 6518 | { | 6523 | { |
| 6519 | regoff_t ret; | 6524 | regoff_t ret; |
| 6520 | struct re_registers regs; | 6525 | struct re_registers regs; |