Projects
Factory:RISC-V:Gnome
glib2
_service:tar_scm:backport-regex-Avoid-allocatin...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-regex-Avoid-allocating-offsets-until-we-ve-a-match.patch of Package glib2
From fe1c2628d52ca67ffe59420a0b4d371893795e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net> Date: Tue, 6 Sep 2022 19:19:03 +0200 Subject: [PATCH] regex: Avoid allocating offsets until we've a match There's no much point of pre-allocating offsets given that we're doing this when needed if only have matches to store. So let's just allocate the spaces for the dummy offset we depend on, while allocate the others on demand. --- glib/gregex.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/glib/gregex.c b/glib/gregex.c index 8a3be9076b..7d403ad53d 100644 --- a/glib/gregex.c +++ b/glib/gregex.c @@ -806,15 +806,11 @@ match_info_new (const GRegex *regex, { /* These values should be enough for most cases, if they are not * enough g_regex_match_all_full() will expand them. */ - match_info->n_offsets = 24; match_info->n_workspace = 100; match_info->workspace = g_new (gint, match_info->n_workspace); } - else - { - match_info->n_offsets = (match_info->n_subpatterns + 1) * 3; - } + match_info->n_offsets = 2; match_info->offsets = g_new0 (gint, match_info->n_offsets); /* Set an invalid position for the previous match. */ match_info->offsets[0] = -1; -- GitLab
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2