Repository: lucy Updated Branches: refs/heads/master f8631ab5e -> de1d8b4d1
Fix mixed decs and code in custom XS Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/de1d8b4d Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/de1d8b4d Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/de1d8b4d Branch: refs/heads/master Commit: de1d8b4d1d1731acb50a3084d768bb737de92d0f Parents: f8631ab Author: Nick Wellnhofer <[email protected]> Authored: Sun Jul 20 21:34:46 2014 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Sun Jul 20 21:34:46 2014 +0200 ---------------------------------------------------------------------- perl/buildlib/Lucy/Build/Binding/Analysis.pm | 23 +++++++++++-------- perl/buildlib/Lucy/Build/Binding/Document.pm | 28 ++++++++++++++--------- perl/buildlib/Lucy/Build/Binding/Object.pm | 9 ++++---- perl/buildlib/Lucy/Build/Binding/Search.pm | 19 ++++++++------- 4 files changed, 46 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/de1d8b4d/perl/buildlib/Lucy/Build/Binding/Analysis.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Analysis.pm b/perl/buildlib/Lucy/Build/Binding/Analysis.pm index 53681bf..5889e65 100644 --- a/perl/buildlib/Lucy/Build/Binding/Analysis.pm +++ b/perl/buildlib/Lucy/Build/Binding/Analysis.pm @@ -347,13 +347,17 @@ new(either_sv, ...) SV *either_sv; CODE: { - SV *text_sv = NULL; - uint32_t start_off = 0; - uint32_t end_off = 0; - int32_t pos_inc = 1; - float boost = 1.0f; - - bool args_ok + SV *text_sv = NULL; + uint32_t start_off = 0; + uint32_t end_off = 0; + int32_t pos_inc = 1; + float boost = 1.0f; + STRLEN len = 0; + char *text = NULL; + lucy_Token *self = NULL; + bool args_ok; + + args_ok = XSBind_allot_params(&(ST(0)), 1, items, ALLOT_SV(&text_sv, "text", 4, true), ALLOT_U32(&start_off, "start_offset", 12, true), @@ -365,9 +369,8 @@ CODE: CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error())); } - STRLEN len; - char *text = SvPVutf8(text_sv, len); - lucy_Token *self = (lucy_Token*)XSBind_new_blank_obj(either_sv); + text = SvPVutf8(text_sv, len); + self = (lucy_Token*)XSBind_new_blank_obj(either_sv); lucy_Token_init(self, text, len, start_off, end_off, boost, pos_inc); RETVAL = CFISH_OBJ_TO_SV_NOINC(self); http://git-wip-us.apache.org/repos/asf/lucy/blob/de1d8b4d/perl/buildlib/Lucy/Build/Binding/Document.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Document.pm b/perl/buildlib/Lucy/Build/Binding/Document.pm index e75e1db..dcbeed9 100644 --- a/perl/buildlib/Lucy/Build/Binding/Document.pm +++ b/perl/buildlib/Lucy/Build/Binding/Document.pm @@ -58,9 +58,13 @@ new(either_sv, ...) SV *either_sv; CODE: { - SV* fields_sv = NULL; - int32_t doc_id = 0; - bool args_ok + SV* fields_sv = NULL; + HV *fields = NULL; + int32_t doc_id = 0; + lucy_Doc *self = NULL; + bool args_ok; + + args_ok = XSBind_allot_params(&(ST(0)), 1, items, ALLOT_SV(&fields_sv, "fields", 6, false), ALLOT_I32(&doc_id, "doc_id", 6, false), @@ -69,7 +73,6 @@ CODE: CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error())); } - HV *fields = NULL; if (fields_sv && XSBind_sv_defined(fields_sv)) { if (SvROK(fields_sv)) { fields = (HV*)SvRV(fields_sv); @@ -79,7 +82,7 @@ CODE: } } - lucy_Doc *self = (lucy_Doc*)XSBind_new_blank_obj(either_sv); + self = (lucy_Doc*)XSBind_new_blank_obj(either_sv); lucy_Doc_init(self, fields, doc_id); RETVAL = CFISH_OBJ_TO_SV_NOINC(self); } @@ -139,10 +142,14 @@ new(either_sv, ...) SV *either_sv; CODE: { - SV *fields_sv = NULL; - int32_t doc_id = 0; - float score = 0.0f; - bool args_ok + SV *fields_sv = NULL; + HV *fields = NULL; + int32_t doc_id = 0; + float score = 0.0f; + lucy_HitDoc *self = NULL; + bool args_ok; + + args_ok = XSBind_allot_params(&(ST(0)), 1, items, ALLOT_SV(&fields_sv, "fields", 6, false), ALLOT_I32(&doc_id, "doc_id", 6, false), @@ -152,7 +159,6 @@ CODE: CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error())); } - HV *fields = NULL; if (fields_sv && XSBind_sv_defined(fields_sv)) { if (SvROK(fields_sv)) { fields = (HV*)SvRV(fields_sv); @@ -162,7 +168,7 @@ CODE: } } - lucy_HitDoc *self = (lucy_HitDoc*)XSBind_new_blank_obj(either_sv); + self = (lucy_HitDoc*)XSBind_new_blank_obj(either_sv); lucy_HitDoc_init(self, fields, doc_id, score); RETVAL = CFISH_OBJ_TO_SV_NOINC(self); } http://git-wip-us.apache.org/repos/asf/lucy/blob/de1d8b4d/perl/buildlib/Lucy/Build/Binding/Object.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Object.pm b/perl/buildlib/Lucy/Build/Binding/Object.pm index a5b94ab..79b4a53 100644 --- a/perl/buildlib/Lucy/Build/Binding/Object.pm +++ b/perl/buildlib/Lucy/Build/Binding/Object.pm @@ -79,10 +79,12 @@ new(either_sv, ...) SV *either_sv; CODE: { - SV *ints_sv = NULL; - lucy_I32Array *self = NULL; + SV *ints_sv = NULL; + AV *ints_av = NULL; + lucy_I32Array *self = NULL; + bool args_ok; - bool args_ok + args_ok = XSBind_allot_params(&(ST(0)), 1, items, ALLOT_SV(&ints_sv, "ints", 4, true), NULL); @@ -90,7 +92,6 @@ CODE: CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error())); } - AV *ints_av = NULL; if (SvROK(ints_sv)) { ints_av = (AV*)SvRV(ints_sv); } http://git-wip-us.apache.org/repos/asf/lucy/blob/de1d8b4d/perl/buildlib/Lucy/Build/Binding/Search.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Search.pm b/perl/buildlib/Lucy/Build/Binding/Search.pm index 9372f8b..eb3202c 100644 --- a/perl/buildlib/Lucy/Build/Binding/Search.pm +++ b/perl/buildlib/Lucy/Build/Binding/Search.pm @@ -425,10 +425,15 @@ new(either_sv, ...) SV *either_sv; CODE: { - SV *type_sv; - SV *value_sv; - - bool args_ok + SV *type_sv = NULL; + SV *value_sv = NULL; + const char *type_str = NULL; + cfish_Obj *value = NULL; + uint32_t type = 0; + lucy_ParserElem *self = NULL; + bool args_ok; + + args_ok = XSBind_allot_params(&(ST(0)), 1, items, ALLOT_SV(&type_sv, "type", 4, true), ALLOT_SV(&value_sv, "value", 5, false), @@ -437,9 +442,7 @@ CODE: if (!args_ok) { CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error())); } - const char *type_str = SvPVutf8_nolen(type_sv); - cfish_Obj *value = NULL; - uint32_t type = 0; + type_str = SvPVutf8_nolen(type_sv); if (strcmp(type_str, "OPEN_PAREN") == 0) { type = LUCY_QPARSER_TOKEN_OPEN_PAREN; @@ -478,7 +481,7 @@ CODE: CFISH_THROW(CFISH_ERR, "Bad type: '%s'", type_str); } - lucy_ParserElem *self = (lucy_ParserElem*)XSBind_new_blank_obj(either_sv); + self = (lucy_ParserElem*)XSBind_new_blank_obj(either_sv); self = lucy_ParserElem_init(self, type, value); RETVAL = XSBind_cfish_to_perl((cfish_Obj*)self); CFISH_DECREF(self);
