GitHub user nwellnhof opened a pull request:
https://github.com/apache/lucy-clownfish/pull/47
Rework labeled arguments in Perl bindings
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nwellnhof/lucy-clownfish labeled_params
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/lucy-clownfish/pull/47.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #47
----
commit fab17a81147f466665ea605319020f2f273490df
Author: Nick Wellnhofer <[email protected]>
Date: 2015-11-20T19:42:26Z
Rework detection of invalid parameters
Don't use a bit vector but scan the stack again for every parameter.
This optimizes the common case (no invalid parameters).
commit ec6c680494255937a0b87ab81effdf916c0cc3e7
Author: Nick Wellnhofer <[email protected]>
Date: 2015-11-20T19:42:27Z
Rework labeled argument assignment
Change the code to assign labeled arguments from
bool args_ok = XSBind_allot_params(aTHX_ &ST(0), 1, items,
ALLOT_SIZE_T(&arg_first, "first", ...),
ALLOT_OBJ(&arg_second, "second", ...),
NULL);
if (!args_ok) {
CFISH_RETHROW(...);
}
to
static const XSBind_Param param_specs[2] = {
XSBIND_PARAM("first", ...),
XSBIND_PARAM("second", ...),
};
int32_t locations[2];
XSBind_locate_args(aTHX_ &ST(0), 1, items, param_specs, locations, 2);
arg_first = (size_t)SvIV(ST(locations[0]));
arg_second = (Type*)XSBind_arg_to_cfish(..., ST(locations[1]), ...);
This simplifies the code, replaces the vararg lists with static arrays and
replaces the switch statement in S_extract_from_sv with direct calls to
conversion functions.
Accept undef for nullable parameters.
Optimize constructors with no parameters.
commit 1b5839993a0be9734d9b191da46cc0eb87d12778
Author: Nick Wellnhofer <[email protected]>
Date: 2015-11-22T17:15:27Z
Remove unused method
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---