That way memory curruption caused by SvGROW on a PL_linestr comming from perl
-e goes away.
git-svn-id: http://dev.catalyst.perl.org/repos/bast/Devel-Declare/1.000/trunk@4876
bd8105ee-0ff8-0310-8827-fb3f25b6796d
int new_len = strlen(new_value);
char* old_linestr = SvPVX(PL_linestr);
- SvGROW(PL_linestr, new_len);
-
- if (SvPVX(PL_linestr) != old_linestr)
+ if (SvLEN(PL_linestr) < new_len) {
croak("forced to realloc PL_linestr for line %s, bailing out before we crash harder", SvPVX(PL_linestr));
+ }
+
+ SvGROW(PL_linestr, new_len);
memcpy(SvPVX(PL_linestr), new_value, new_len+1);