Simplify pattern in adjust_eols() in 'parsecode' module

This commit is contained in:
Thomas Jensen 2024-05-13 21:55:50 +02:00
parent 13c5ef8e43
commit 0dcfdf2963
No known key found for this signature in database
GPG Key ID: A4ACEE270D0FB7DB

View File

@ -874,7 +874,7 @@ int action_add_alias(pass_to_bison *bison_args, char *alias_name)
static bxstr_t *adjust_eols(uint32_t *sample) static bxstr_t *adjust_eols(uint32_t *sample)
{ {
if (eol_pattern == NULL) { if (eol_pattern == NULL) {
eol_pattern = compile_pattern("(?(?=\r)(\r\n?)|(\n))"); eol_pattern = compile_pattern("(?:(\r\n?)|(\n))");
} }
uint32_t *replaced = regex_replace(eol_pattern, opt.eol, sample, u32_strlen(sample), 1); uint32_t *replaced = regex_replace(eol_pattern, opt.eol, sample, u32_strlen(sample), 1);
bxstr_t *result = bxs_from_unicode(replaced); bxstr_t *result = bxs_from_unicode(replaced);