1.1 --- a/templates/progops.c Sun Mar 05 23:06:54 2017 +0100
1.2 +++ b/templates/progops.c Mon Mar 06 00:13:47 2017 +0100
1.3 @@ -197,7 +197,7 @@
1.4
1.5 /* Reserve enough space for the arguments. */
1.6
1.7 - __attr allargs[max];
1.8 + __attr *allargs = args, moreargs[max];
1.9
1.10 /* Traverse the arguments. */
1.11
1.12 @@ -211,39 +211,44 @@
1.13
1.14 /* Copy the arguments. */
1.15
1.16 - for (pos = 0; pos < nargs; pos++)
1.17 - allargs[pos] = args[pos];
1.18 + if (nargs < max)
1.19 + {
1.20 + allargs = moreargs;
1.21
1.22 - /* Erase the remaining arguments. */
1.23 + for (pos = 0; pos < nargs; pos++)
1.24 + allargs[pos] = args[pos];
1.25 +
1.26 + /* Erase the remaining arguments. */
1.27
1.28 - for (pos = nargs; pos < max; pos++)
1.29 - allargs[pos].value = 0;
1.30 + for (pos = nargs; pos < max; pos++)
1.31 + allargs[pos].value = 0;
1.32
1.33 - /* Fill keyword arguments. */
1.34 + /* Fill keyword arguments. */
1.35
1.36 - for (kwpos = 0; kwpos < nkwargs; kwpos++)
1.37 - {
1.38 - pos = __HASPARAM(ptable, kwcodes[kwpos].pos, kwcodes[kwpos].code);
1.39 + for (kwpos = 0; kwpos < nkwargs; kwpos++)
1.40 + {
1.41 + pos = __HASPARAM(ptable, kwcodes[kwpos].pos, kwcodes[kwpos].code);
1.42
1.43 - /* Check the table entry against the supplied argument details.
1.44 - Set the argument but only if it does not overwrite positional
1.45 - arguments. */
1.46 - /* NOTE: Should use a more specific exception. */
1.47 + /* Check the table entry against the supplied argument details.
1.48 + Set the argument but only if it does not overwrite positional
1.49 + arguments. */
1.50 + /* NOTE: Should use a more specific exception. */
1.51
1.52 - if ((pos == -1) || (pos < nargs))
1.53 - __raise_type_error();
1.54 + if ((pos == -1) || (pos < nargs))
1.55 + __raise_type_error();
1.56
1.57 - /* Set the argument using the appropriate position. */
1.58 + /* Set the argument using the appropriate position. */
1.59
1.60 - allargs[pos] = kwargs[kwpos];
1.61 - }
1.62 + allargs[pos] = kwargs[kwpos];
1.63 + }
1.64
1.65 - /* Fill the defaults. */
1.66 + /* Fill the defaults. */
1.67
1.68 - for (pos = nargs; pos < max; pos++)
1.69 - {
1.70 - if (allargs[pos].value == 0)
1.71 - allargs[pos] = __GETDEFAULT(target.value, pos - min);
1.72 + for (pos = nargs; pos < max; pos++)
1.73 + {
1.74 + if (allargs[pos].value == 0)
1.75 + allargs[pos] = __GETDEFAULT(target.value, pos - min);
1.76 + }
1.77 }
1.78
1.79 /* Call with the prepared arguments. */