Subject: | [PATCH] use C |
Attached patch doesn't enforce C++.
Would it possible to push this repro to github also? Much easier to contribute this way. Thanks!
--
Reini Urban
Subject: | c.patch |
diff -bu ./Export.xs~ ./Export.xs
--- ./Export.xs~ 2014-02-01 17:54:07.000000000 -0600
+++ ./Export.xs 2014-07-31 16:46:38.035912011 -0500
@@ -17,10 +17,13 @@
#define __PACKAGE__ "Panda::Export"
+static HV* clists;
+
AV* get_global_clist (HV* stash) {
- static HV* clists = newHV();
- SV* clist = *hv_fetch(clists, HvNAME(stash), HvNAMELEN(stash), 1);
+ SV* clist;
AV* ret;
+
+ clist = *hv_fetch(clists, HvNAME(stash), HvNAMELEN(stash), 1);
if (!SvOK(clist)) {
SvUPGRADE(clist, SVt_RV);
SvROK_on(clist);
@@ -36,7 +39,8 @@
AV* clist = get_global_clist(target);
I32 size = hv_iterinit(constants);
- for (I32 i = 0; i < size; i++) {
+ I32 i;
+ for (i = 0; i < size; i++) {
HE* pair = hv_iternext(constants);
char* key = HeKEY(pair);
I32 klen = HeKLEN(pair);
@@ -61,7 +65,8 @@
void export_subs (HV* from, HV* to, AV* list) {
if (list != NULL) {
I32 size = av_len(list);
- for (I32 i = 0; i <= size; i++) {
+ I32 i;
+ for (i = 0; i <= size; i++) {
SV* nameSV = *av_fetch(list, i, 0);
STRLEN namelen;
const char* name = SvPV(nameSV, namelen);
@@ -101,8 +106,9 @@
else {
AV* list = NULL;
if (items >= 2) {
+ int i;
list = newAV();
- for (int i = 1; i < items; i++) {
+ for (i = 1; i < items; i++) {
SV* name = ST(i);
SvREFCNT_inc(name);
av_push(list, name);
@@ -126,3 +132,6 @@
OUTPUT:
RETVAL
+
+BOOT:
+ clists = newHV();
diff -bu ./Makefile.PL~ ./Makefile.PL
--- ./Makefile.PL~ 2014-02-01 17:54:07.000000000 -0600
+++ ./Makefile.PL 2014-07-31 16:43:36.145620725 -0500
@@ -4,9 +4,9 @@
all_from 'lib/Panda/Export.pm';
makemaker_args(
- CC => 'c++',
- LD => '$(CC)',
- XSOPT => '-C++',
+ #CC => 'c++',
+ #LD => '$(CC)',
+ #XSOPT => '-C++',
);
auto_install;