From f2b6d100d8958a9c811c950f113a0ce38a25d484 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 6 Dec 2016 22:06:26 +0200 Subject: Add min_required and max_expected arg counts to API. --- extension/fnmatch.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'extension/fnmatch.c') diff --git a/extension/fnmatch.c b/extension/fnmatch.c index f5fb02c6..caf64a7b 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -107,13 +107,8 @@ do_fnmatch(int nargs, awk_value_t *result) int int_flags, retval; make_number(-1.0, result); /* default return */ -#ifdef HAVE_FNMATCH - if (nargs < 3) { - warning(ext_id, _("fnmatch: called with less than three arguments")); - goto out; - } else if (do_lint && nargs > 3) - lintwarn(ext_id, _("fnmatch: called with more than three arguments")); +#ifdef HAVE_FNMATCH if (! get_argument(0, AWK_STRING, & pattern)) { warning(ext_id, _("fnmatch: could not get first argument")); goto out; @@ -199,7 +194,7 @@ init_fnmatch(void) } static awk_ext_func_t func_table[] = { - { "fnmatch", do_fnmatch, 3 }, + { "fnmatch", do_fnmatch, 3, 3 }, }; /* define the dl_load function using the boilerplate macro */ -- cgit v1.2.3 From 0855ef4db6d8e0d1d57776eb273c9de321bfd6cf Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 14 Dec 2016 21:25:20 +0200 Subject: Fix lint stuff, arg checking. Add a data pointer. Pass finfo to functions. --- extension/fnmatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'extension/fnmatch.c') diff --git a/extension/fnmatch.c b/extension/fnmatch.c index caf64a7b..5382e4bc 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -95,7 +95,7 @@ int plugin_is_GPL_compatible; /* do_fnmatch --- implement the fnmatch interface */ static awk_value_t * -do_fnmatch(int nargs, awk_value_t *result) +do_fnmatch(int nargs, awk_value_t *result, struct awk_ext_func *unused) { #ifdef HAVE_FNMATCH_H static int flags_mask = @@ -194,7 +194,7 @@ init_fnmatch(void) } static awk_ext_func_t func_table[] = { - { "fnmatch", do_fnmatch, 3, 3 }, + { "fnmatch", do_fnmatch, 3, 3, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ -- cgit v1.2.3