From d851540e8611be939ac01a4f6c87ade351d6ad0b Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 30 May 2016 17:07:46 -0400 Subject: Allow extension functions to get more arguments than expected. --- ext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ext.c') diff --git a/ext.c b/ext.c index c16ab60a..c0d6f150 100644 --- a/ext.c +++ b/ext.c @@ -99,7 +99,7 @@ make_builtin(const awk_ext_func_t *funcinfo) const char *sp; char c; const char *name = funcinfo->name; - int count = funcinfo->num_expected_args; + int count = funcinfo->max_expected_args; sp = name; if (sp == NULL || *sp == '\0') @@ -156,10 +156,9 @@ get_argument(int i) INSTRUCTION *pc; pc = TOP()->code_ptr; /* Op_ext_builtin instruction */ - pcount = (pc + 1)->expr_count; /* max # of arguments */ arg_count = pc->expr_count; /* # of arguments supplied */ - if (i < 0 || i >= pcount || i >= arg_count) + if (i < 0 || i >= arg_count) return NULL; t = PEEK(arg_count - i); -- cgit v1.2.3