]> git.wincent.com - wikitext.git/commitdiff
Remove unnecessary allocation from _Wikitext_parser_sanitize_link_target
authorWincent Colaiuta <win@wincent.com>
Mon, 11 May 2009 16:25:50 +0000 (18:25 +0200)
committerWincent Colaiuta <win@wincent.com>
Mon, 11 May 2009 16:25:50 +0000 (18:25 +0200)
This temporary String object isn't required.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
ext/parser.c

index 061138b65a9cbcdc874dac4b8aa94ad3e9886fe4..a2f60ec25739e5d6dc8e7519c574a4474e16e972 100644 (file)
@@ -716,10 +716,9 @@ void _Wikitext_parser_trim_link_text(parser_t *parser)
 // - if rollback is false, leading and trailing whitespace trimmed
 VALUE _Wikitext_parser_sanitize_link_target(parser_t *parser, bool rollback)
 {
-    VALUE   string  = string_from_str(parser->link_target);
-    char    *src    = RSTRING_PTR(string);
+    char    *src    = parser->link_target->ptr;
     char    *start  = src;                  // remember this so we can check if we're at the start
-    long    len     = RSTRING_LEN(string);
+    long    len     = parser->link_target->len;
     char    *end    = src + len;
 
     // start with a destination buffer twice the size of the source, will realloc if necessary