diff options
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r-- | src/gmdocument.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 42aec9e6..89d567b0 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -192,9 +192,12 @@ iInt2 measurePreformattedBlock_GmDocument_(const iGmDocument *d, const char *sta | |||
192 | } | 192 | } |
193 | 193 | ||
194 | static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *linkId) { | 194 | static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *linkId) { |
195 | iRegExp *pattern = new_RegExp("=>\\s*([^\\s]+)(\\s.*)?", caseInsensitive_RegExpOption); | 195 | static iRegExp *pattern_; |
196 | if (!pattern_) { | ||
197 | pattern_ = new_RegExp("=>\\s*([^\\s]+)(\\s.*)?", caseInsensitive_RegExpOption); | ||
198 | } | ||
196 | iRegExpMatch m; | 199 | iRegExpMatch m; |
197 | if (matchRange_RegExp(pattern, line, &m)) { | 200 | if (matchRange_RegExp(pattern_, line, &m)) { |
198 | iGmLink *link = new_GmLink(); | 201 | iGmLink *link = new_GmLink(); |
199 | setRange_String(&link->url, capturedRange_RegExpMatch(&m, 1)); | 202 | setRange_String(&link->url, capturedRange_RegExpMatch(&m, 1)); |
200 | set_String(&link->url, absoluteUrl_String(&d->url, &link->url)); | 203 | set_String(&link->url, absoluteUrl_String(&d->url, &link->url)); |
@@ -254,7 +257,6 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li | |||
254 | line = capturedRange_RegExpMatch(&m, 1); /* Show the URL. */ | 257 | line = capturedRange_RegExpMatch(&m, 1); /* Show the URL. */ |
255 | } | 258 | } |
256 | } | 259 | } |
257 | iRelease(pattern); | ||
258 | return line; | 260 | return line; |
259 | } | 261 | } |
260 | 262 | ||