* Save away any existing arguments for the given procedure, so that we can * install new values for a recursive call. This should be invoked before * doing PLy_function_build_args() or PLy_trigger_build_args(). * * NB: callers must ensure that PLy_global_args_pop gets invoked once, and * only once, per successful completion of PLy_global_args_push. Otherwise * we'll end up out-of-sync betw
| 614 | * of proc->argstack. |
| 615 | */ |
| 616 | static void |
| 617 | PLy_global_args_push(PLyProcedure *proc) |
| 618 | { |
| 619 | /* We only need to push if we are already inside some active call */ |
| 620 | if (proc->calldepth > 0) |
| 621 | { |
| 622 | PLySavedArgs *node; |
| 623 | |
| 624 | /* Build a struct containing current argument values */ |
| 625 | node = PLy_function_save_args(proc); |
| 626 | |
| 627 | /* |
| 628 | * Push the saved argument values into the procedure's stack. Once we |
| 629 | * modify either proc->argstack or proc->calldepth, we had better |
| 630 | * return without the possibility of error. |
| 631 | */ |
| 632 | node->next = proc->argstack; |
| 633 | proc->argstack = node; |
| 634 | } |
| 635 | proc->calldepth++; |
| 636 | } |
| 637 | |
| 638 | /* |
| 639 | * Pop old arguments when exiting a recursive call. |
no test coverage detected