Skip to content

Commit f923bf1

Browse files
committed
remove copying inputs into end-area as CopyBadStatus gone - #517
1 parent 59b75dc commit f923bf1

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

lib/PDL/Core/pdlapi.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -753,11 +753,6 @@ pdl_error pdl_make_trans_mutual(pdl_trans *trans)
753753
pdl_transvtable *vtable = trans->vtable;
754754
pdl **pdls = trans->pdls;
755755
PDL_Indx i, npdls=vtable->npdls, nparents=vtable->nparents;
756-
PDL_Indx nchildren = npdls - nparents;
757-
/* copy the converted outputs from the end-area to use as actual
758-
outputs - cf type_coerce */
759-
for (i=vtable->nparents; i<vtable->npdls; i++) pdls[i] = pdls[i+nchildren];
760-
PDLDEBUG_f(printf("make_trans_mutual after copy converted ");pdl_dump_trans_fixspace(trans,0));
761756
PDL_TR_CHKMAGIC(trans);
762757
char disable_back = 0, inputs_bad = 0;
763758
for (i=0; i<npdls; i++) {
@@ -1137,9 +1132,7 @@ PDL_Anyval pdl_get_pdl_badvalue( pdl *it ) {
11371132
}
11381133

11391134
pdl_trans *pdl_create_trans(pdl_transvtable *vtable) {
1140-
size_t it_sz = sizeof(pdl_trans)+sizeof(pdl *)*(
1141-
vtable->npdls + (vtable->npdls - vtable->nparents) /* outputs twice */
1142-
);
1135+
size_t it_sz = sizeof(pdl_trans)+(sizeof(pdl *) * vtable->npdls);
11431136
pdl_trans *it = malloc(it_sz);
11441137
if (!it) return it;
11451138
memset(it, 0, it_sz);
@@ -1310,8 +1303,7 @@ pdl_error pdl__type_convert(pdl_trans *trans, int recurse_count) {
13101303
return pdl_make_error_simple(PDL_EFATAL, "type not expected value after get_convertedpdl\n");
13111304
if (i == inplace_output_ind)
13121305
pdls[inplace_input_ind] = pdl;
1313-
/* if type-convert output, put in end-area */
1314-
pdls[i + (i >= nparents ? nchildren : 0)] = pdl;
1306+
pdls[i] = pdl;
13151307
}
13161308
return PDL_err;
13171309
}
@@ -1324,13 +1316,6 @@ pdl_error pdl__type_coerce_recprotect(pdl_trans *trans, int recurse_count) {
13241316
pdl_datatypes trans_dtype;
13251317
PDL_RETERROR(PDL_err, pdl__transtype_select(trans, &trans_dtype));
13261318
trans->__datatype = trans_dtype;
1327-
pdl_transvtable *vtable = trans->vtable;
1328-
pdl **pdls = trans->pdls;
1329-
PDL_Indx i, nparents = vtable->nparents, nchildren = vtable->npdls - nparents;
1330-
/* copy the "real" (passed-in) outputs to the end-area to use as actual
1331-
outputs, possibly after being converted, leaving the passed-in ones
1332-
alone to be picked up for use in CopyBadStatusCode */
1333-
for (i=nparents; i<vtable->npdls; i++) pdls[i+nchildren] = pdls[i];
13341319
PDL_RETERROR(PDL_err, pdl__set_output_type_badvalue(trans, recurse_count+1));
13351320
PDL_RETERROR(PDL_err, pdl__type_convert(trans, recurse_count+1));
13361321
return PDL_err;

lib/PDL/Core/pdlconv.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ pdl_error pdl__converttypei_new_recprotect(pdl *PARENT, pdl *CHILD, pdl_datatype
257257
trans->pdls[1] = CHILD;
258258
trans->__datatype = PARENT->datatype = force_intype;
259259
PDL_RETERROR(PDL_err, pdl__set_output_type_badvalue(trans, recurse_count + 1));
260-
trans->pdls[2] = trans->pdls[1]; /* copy for make_trans_mutual */
261260
trans->pdls[1]->datatype = params->totype = totype;
262261
PDL_RETERROR(PDL_err, pdl_make_trans_mutual((pdl_trans *)trans));
263262
return PDL_err;

0 commit comments

Comments
 (0)