| 390 | `--------------------------------------------------------------------------*/ |
| 391 | |
| 392 | static void |
| 393 | compile_regex (struct regex_data *regex) |
| 394 | { |
| 395 | struct re_pattern_buffer *pattern = ®ex->pattern; |
| 396 | char const *string = regex->string; |
| 397 | char const *message; |
| 398 | |
| 399 | pattern->buffer = NULL; |
| 400 | pattern->allocated = 0; |
| 401 | pattern->fastmap = regex->fastmap; |
| 402 | pattern->translate = ignore_case ? folded_chars : NULL; |
| 403 | |
| 404 | message = re_compile_pattern (string, strlen (string), pattern); |
| 405 | if (message) |
| 406 | error (EXIT_FAILURE, 0, _("%s (for regexp %s)"), message, quote (string)); |
| 407 | |
| 408 | /* The fastmap should be compiled before 're_match'. The following |
| 409 | call is not mandatory, because 're_search' is always called sooner, |
| 410 | and it compiles the fastmap if this has not been done yet. */ |
| 411 | |
| 412 | re_compile_fastmap (pattern); |
| 413 | } |
| 414 | |
| 415 | /*------------------------------------------------------------------------. |
| 416 | | This will initialize various tables for pattern match and compiles some | |