d5b38d9952
- fix perl_render() - avoid "uninitialized value" warnings - fix perlcs_parseString() - correct malloc: use len+1 instead of len Also, take maintainership. PR: ports/127108 Submitted by: skv Approved by: rink (previous maintainer)
34 lines
808 B
Text
34 lines
808 B
Text
--- ClearSilver.xs.orig 2008-10-04 15:16:18.000000000 +0000
|
|
+++ ClearSilver.xs 2008-10-04 15:20:37.000000000 +0000
|
|
@@ -401,7 +401,11 @@
|
|
ClearSilver::CS cs
|
|
CODE:
|
|
{
|
|
- SV *str = newSV(0);
|
|
+ SV *str = newSV(1);
|
|
+ SvLEN_set(str, 0);
|
|
+ SvCUR_set(str, 0);
|
|
+ SvPOK_on(str);
|
|
+
|
|
cs->err = cs_render(cs->cs, str, output);
|
|
if (cs->err == STATUS_OK) {
|
|
ST(0) = sv_2mortal(str);
|
|
@@ -439,7 +443,7 @@
|
|
CODE:
|
|
do {
|
|
len = strlen(in_str);
|
|
- cs_str = (char *)malloc(len);
|
|
+ cs_str = (char *)malloc(len + 1);
|
|
if (!cs_str) {
|
|
RETVAL = 0;
|
|
break;
|
|
@@ -448,7 +452,8 @@
|
|
cs->err = cs_parse_string(cs->cs, cs_str, len);
|
|
if (cs->err != STATUS_OK)
|
|
RETVAL = 0;
|
|
- RETVAL = 1;
|
|
+ else
|
|
+ RETVAL = 1;
|
|
} while (0);
|
|
OUTPUT:
|
|
RETVAL
|