MCPcopy Create free account
hub / github.com/coreutils/coreutils / compile_regex

Function compile_regex

src/ptx.c:392–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390`--------------------------------------------------------------------------*/
391
392static void
393compile_regex (struct regex_data *regex)
394{
395 struct re_pattern_buffer *pattern = &regex->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 |

Callers 1

initialize_regexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected