Fix returning strings from variadic functions (lost changes) (#399)
This commit is contained in:
parent
3e660011b2
commit
faa9f6ea9f
|
@ -5308,6 +5308,18 @@ static symbol *fetchlab(char *name)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int is_variadic(symbol *sym)
|
||||||
|
{
|
||||||
|
arginfo *arg;
|
||||||
|
|
||||||
|
assert(sym->ident==iFUNCTN);
|
||||||
|
for (arg = sym->dim.arglist; arg->ident; arg++) {
|
||||||
|
if (arg->ident == iVARARGS)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* doreturn
|
/* doreturn
|
||||||
*
|
*
|
||||||
* Global references: rettype (altered)
|
* Global references: rettype (altered)
|
||||||
|
@ -5412,7 +5424,11 @@ static void doreturn(void)
|
||||||
* it stays on the heap for the moment, and it is removed -usually- at
|
* it stays on the heap for the moment, and it is removed -usually- at
|
||||||
* the end of the expression/statement, see expression() in SC3.C)
|
* the end of the expression/statement, see expression() in SC3.C)
|
||||||
*/
|
*/
|
||||||
|
if (is_variadic(curfunc)) {
|
||||||
|
load_hidden_arg();
|
||||||
|
} else {
|
||||||
address(sub,sALT); /* ALT = destination */
|
address(sub,sALT); /* ALT = destination */
|
||||||
|
}
|
||||||
arraysize=calc_arraysize(dim,numdim,0);
|
arraysize=calc_arraysize(dim,numdim,0);
|
||||||
memcopy(arraysize*sizeof(cell)); /* source already in PRI */
|
memcopy(arraysize*sizeof(cell)); /* source already in PRI */
|
||||||
/* moveto1(); is not necessary, callfunction() does a popreg() */
|
/* moveto1(); is not necessary, callfunction() does a popreg() */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user