From: Florian Ragwitz Date: Sat, 4 Oct 2008 02:31:41 +0000 (+0000) Subject: Don't call strlen() twice on the same string. X-Git-Tag: 0.005000~83 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c41867d8ec7c0ccb5280662e64c9cd5c70560ec6;hp=f9eb22eb9913ce6855213c48d33cc36734c1998e;p=p5sagit%2FDevel-Declare.git Don't call strlen() twice on the same string. --- diff --git a/Declare.xs b/Declare.xs index 4148673..9b10cc4 100644 --- a/Declare.xs +++ b/Declare.xs @@ -120,7 +120,7 @@ void dd_set_linestr(pTHX_ char* new_value) { int new_len = strlen(new_value); char* old_linestr = SvPVX(PL_linestr); - SvGROW(PL_linestr, strlen(new_value)); + SvGROW(PL_linestr, new_len); if (SvPVX(PL_linestr) != old_linestr) croak("forced to realloc PL_linestr for line %s, bailing out before we crash harder", SvPVX(PL_linestr));