Reed Russell - rreed <[EMAIL PROTECTED]> writes:
> The sv_catpvn_utf8_upgrade macro used in hparser.c in versions 3.40 and 3.41
> of HTML::Parser doesn't seem to exist in Perl 5.8.0. Can the macro be
> replaced, so that the module is compatible with this version of Perl?
Sure. Applied. I've simpified your patch to be:
Index: hparser.c
===================================================================
RCS file: /cvsroot/libwww-perl/html-parser/hparser.c,v
retrieving revision 2.117
diff -u -p -r2.117 hparser.c
--- hparser.c 2 Dec 2004 11:14:59 -0000 2.117
+++ hparser.c 2 Dec 2004 11:50:59 -0000
@@ -300,8 +300,10 @@ report_event(PSTATE* p_state,
sv_catpvn(p_state->pend_text, beg, end - beg);
}
else {
- SV *tmp = NULL;
- sv_catpvn_utf8_upgrade(p_state->pend_text, beg, end - beg, tmp);
+ SV *tmp = newSVpvn(beg, end - beg);
+ sv_utf8_upgrade(tmp);
+ sv_catsv(p_state->pend_text, tmp);
+ SvREFCNT_dec(tmp);
}
#else
sv_catpvn(p_state->pend_text, beg, end - beg);
@@ -639,8 +641,10 @@ IGNORE_EVENT:
#ifdef UNICODE_HTML_PARSER
}
else {
- SV *tmp = NULL;
- sv_catpvn_utf8_upgrade(p_state->skipped_text, beg, end - beg, tmp);
+ SV *tmp = newSVpvn(beg, end - beg);
+ sv_utf8_upgrade(tmp);
+ sv_catsv(p_state->pend_text, tmp);
+ SvREFCNT_dec(tmp);
}
#endif
}