Repository: lucy Updated Branches: refs/heads/master a61402777 -> 6c78b530d
Adjust for PERL_NO_GET_CONTEXT Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/6c78b530 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/6c78b530 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/6c78b530 Branch: refs/heads/master Commit: 6c78b530dc6e71c8f28b322943c14026c2e9f70b Parents: a614027 Author: Nick Wellnhofer <[email protected]> Authored: Mon Apr 13 16:58:45 2015 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Mon Apr 13 17:00:48 2015 +0200 ---------------------------------------------------------------------- perl/buildlib/Lucy/Build/Binding/Analysis.pm | 8 +++--- perl/buildlib/Lucy/Build/Binding/Document.pm | 12 ++++---- perl/buildlib/Lucy/Build/Binding/Index.pm | 10 +++---- perl/buildlib/Lucy/Build/Binding/Misc.pm | 6 ++-- perl/buildlib/Lucy/Build/Binding/Object.pm | 6 ++-- perl/buildlib/Lucy/Build/Binding/Search.pm | 15 ++++++---- perl/buildlib/Lucy/Build/Binding/Util.pm | 2 +- perl/xs/Lucy/Analysis/RegexTokenizer.c | 28 +++++++++++-------- perl/xs/Lucy/Document/Doc.c | 34 ++++++++++++++++------- perl/xs/Lucy/Index/DocReader.c | 1 + perl/xs/Lucy/Index/Inverter.c | 5 ++-- 11 files changed, 76 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/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 82745fe..11dc3b2 100644 --- a/perl/buildlib/Lucy/Build/Binding/Analysis.pm +++ b/perl/buildlib/Lucy/Build/Binding/Analysis.pm @@ -125,13 +125,13 @@ CODE: if (items > 1) { SV *text_sv = NULL; bool args_ok - = XSBind_allot_params(&(ST(0)), 1, items, + = XSBind_allot_params(aTHX_ &(ST(0)), 1, items, ALLOT_SV(&text_sv, "text", 4, false), NULL); if (!args_ok) { CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error())); } - if (XSBind_sv_defined(text_sv)) { + if (XSBind_sv_defined(aTHX_ text_sv)) { STRLEN len; char *text = SvPVutf8(text_sv, len); starter_token = lucy_Token_new(text, len, 0, len, 1.0, 1); @@ -363,7 +363,7 @@ CODE: bool args_ok; args_ok - = XSBind_allot_params(&(ST(0)), 1, items, + = XSBind_allot_params(aTHX_ &(ST(0)), 1, items, ALLOT_SV(&text_sv, "text", 4, true), ALLOT_U32(&start_off, "start_offset", 12, true), ALLOT_U32(&end_off, "end_offset", 10, true), @@ -375,7 +375,7 @@ CODE: } text = SvPVutf8(text_sv, len); - self = (lucy_Token*)XSBind_new_blank_obj(either_sv); + self = (lucy_Token*)XSBind_new_blank_obj(aTHX_ 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/6c78b530/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 3679bfe..b495f71 100644 --- a/perl/buildlib/Lucy/Build/Binding/Document.pm +++ b/perl/buildlib/Lucy/Build/Binding/Document.pm @@ -65,7 +65,7 @@ CODE: bool args_ok; args_ok - = XSBind_allot_params(&(ST(0)), 1, items, + = XSBind_allot_params(aTHX_ &(ST(0)), 1, items, ALLOT_SV(&fields_sv, "fields", 6, false), ALLOT_I32(&doc_id, "doc_id", 6, false), NULL); @@ -73,7 +73,7 @@ CODE: CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error())); } - if (fields_sv && XSBind_sv_defined(fields_sv)) { + if (fields_sv && XSBind_sv_defined(aTHX_ fields_sv)) { if (SvROK(fields_sv)) { fields = (HV*)SvRV(fields_sv); } @@ -82,7 +82,7 @@ CODE: } } - self = (lucy_Doc*)XSBind_new_blank_obj(either_sv); + self = (lucy_Doc*)XSBind_new_blank_obj(aTHX_ either_sv); lucy_Doc_init(self, fields, doc_id); RETVAL = CFISH_OBJ_TO_SV_NOINC(self); } @@ -150,7 +150,7 @@ CODE: bool args_ok; args_ok - = XSBind_allot_params(&(ST(0)), 1, items, + = XSBind_allot_params(aTHX_ &(ST(0)), 1, items, ALLOT_SV(&fields_sv, "fields", 6, false), ALLOT_I32(&doc_id, "doc_id", 6, false), ALLOT_F32(&score, "score", 5, false), @@ -159,7 +159,7 @@ CODE: CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error())); } - if (fields_sv && XSBind_sv_defined(fields_sv)) { + if (fields_sv && XSBind_sv_defined(aTHX_ fields_sv)) { if (SvROK(fields_sv)) { fields = (HV*)SvRV(fields_sv); } @@ -168,7 +168,7 @@ CODE: } } - self = (lucy_HitDoc*)XSBind_new_blank_obj(either_sv); + self = (lucy_HitDoc*)XSBind_new_blank_obj(aTHX_ 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/6c78b530/perl/buildlib/Lucy/Build/Binding/Index.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Index.pm b/perl/buildlib/Lucy/Build/Binding/Index.pm index ccd26f7..781e0da 100644 --- a/perl/buildlib/Lucy/Build/Binding/Index.pm +++ b/perl/buildlib/Lucy/Build/Binding/Index.pm @@ -304,7 +304,7 @@ set_race_condition_debug1(val_sv) PPCODE: CFISH_DECREF(lucy_PolyReader_race_condition_debug1); lucy_PolyReader_race_condition_debug1 = (cfish_String*) - XSBind_maybe_sv_to_cfish_obj(val_sv, CFISH_STRING, NULL); + XSBind_maybe_sv_to_cfish_obj(aTHX_ val_sv, CFISH_STRING, NULL); if (lucy_PolyReader_race_condition_debug1) { (void)CFISH_INCREF(lucy_PolyReader_race_condition_debug1); } @@ -471,7 +471,7 @@ PPCODE: } else if (items > 2) { bool args_ok - = XSBind_allot_params(&(ST(0)), 1, items, + = XSBind_allot_params(aTHX_ &(ST(0)), 1, items, ALLOT_SV(&doc_sv, "doc", 3, true), ALLOT_F32(&boost, "boost", 5, false), NULL); @@ -490,7 +490,7 @@ PPCODE: IV tmp = SvIV(SvRV(doc_sv)); doc = INT2PTR(lucy_Doc*, tmp); } - else if (XSBind_sv_defined(doc_sv) && SvROK(doc_sv)) { + else if (XSBind_sv_defined(aTHX_ doc_sv) && SvROK(doc_sv)) { HV *maybe_fields = (HV*)SvRV(doc_sv); if (SvTYPE((SV*)maybe_fields) == SVt_PVHV) { doc = LUCY_Indexer_Get_Stock_Doc(self); @@ -929,7 +929,7 @@ CODE: { int32_t ord = 0; bool args_ok - = XSBind_allot_params(&(ST(0)), 1, items, + = XSBind_allot_params(aTHX_ &(ST(0)), 1, items, ALLOT_I32(&ord, "ord", 3, false), NULL); if (!args_ok) { @@ -937,7 +937,7 @@ CODE: } { cfish_Obj *value = LUCY_SortCache_Value(self, ord); - RETVAL = XSBind_cfish_to_perl(value); + RETVAL = XSBind_cfish_to_perl(aTHX_ value); CFISH_DECREF(value); } } http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/perl/buildlib/Lucy/Build/Binding/Misc.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm index 457e845..dbc54d0 100644 --- a/perl/buildlib/Lucy/Build/Binding/Misc.pm +++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm @@ -45,7 +45,7 @@ to_clownfish(sv) SV *sv; CODE: { - cfish_Obj *obj = XSBind_perl_to_cfish(sv); + cfish_Obj *obj = XSBind_perl_to_cfish(aTHX_ sv); RETVAL = CFISH_OBJ_TO_SV_NOINC(obj); } OUTPUT: RETVAL @@ -58,7 +58,7 @@ CODE: if (sv_isobject(sv) && sv_derived_from(sv, "Clownfish::Obj")) { IV tmp = SvIV(SvRV(sv)); cfish_Obj* obj = INT2PTR(cfish_Obj*, tmp); - RETVAL = XSBind_cfish_to_perl(obj); + RETVAL = XSBind_cfish_to_perl(aTHX_ obj); } else { RETVAL = newSVsv(sv); @@ -84,7 +84,7 @@ PPCODE: LUCY_OutStream_Close(target); serialized_bb = LUCY_RAMFile_Get_Contents(LUCY_RAMFH_Get_File(file_handle)); - retval = XSBind_bb_to_sv(serialized_bb); + retval = XSBind_bb_to_sv(aTHX_ serialized_bb); CFISH_DECREF(file_handle); CFISH_DECREF(target); http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/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 c1f8f5a..aa7d536 100644 --- a/perl/buildlib/Lucy/Build/Binding/Object.pm +++ b/perl/buildlib/Lucy/Build/Binding/Object.pm @@ -87,7 +87,7 @@ CODE: bool args_ok; args_ok - = XSBind_allot_params(&(ST(0)), 1, items, + = XSBind_allot_params(aTHX_ &(ST(0)), 1, items, ALLOT_SV(&ints_sv, "ints", 4, true), NULL); if (!args_ok) { @@ -104,11 +104,11 @@ CODE: for (i = 0; i < size; i++) { SV **const sv_ptr = av_fetch(ints_av, i, 0); - ints[i] = (sv_ptr && XSBind_sv_defined(*sv_ptr)) + ints[i] = (sv_ptr && XSBind_sv_defined(aTHX_ *sv_ptr)) ? SvIV(*sv_ptr) : 0; } - self = (lucy_I32Array*)XSBind_new_blank_obj(either_sv); + self = (lucy_I32Array*)XSBind_new_blank_obj(aTHX_ either_sv); lucy_I32Arr_init(self, ints, size); } else { http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/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 ac55c92..1602945 100644 --- a/perl/buildlib/Lucy/Build/Binding/Search.pm +++ b/perl/buildlib/Lucy/Build/Binding/Search.pm @@ -434,7 +434,7 @@ CODE: bool args_ok; args_ok - = XSBind_allot_params(&(ST(0)), 1, items, + = XSBind_allot_params(aTHX_ &(ST(0)), 1, items, ALLOT_SV(&type_sv, "type", 4, true), ALLOT_SV(&value_sv, "value", 5, false), NULL); @@ -467,23 +467,26 @@ CODE: } else if (strcmp(type_str, "FIELD") == 0) { type = LUCY_QPARSER_TOKEN_FIELD; - value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), CFISH_STRING); + value = CFISH_CERTIFY(XSBind_perl_to_cfish(aTHX_ value_sv), + CFISH_STRING); } else if (strcmp(type_str, "STRING") == 0) { type = LUCY_QPARSER_TOKEN_STRING; - value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), CFISH_STRING); + value = CFISH_CERTIFY(XSBind_perl_to_cfish(aTHX_ value_sv), + CFISH_STRING); } else if (strcmp(type_str, "QUERY") == 0) { type = LUCY_QPARSER_TOKEN_QUERY; - value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), LUCY_QUERY); + value = CFISH_CERTIFY(XSBind_perl_to_cfish(aTHX_ value_sv), + LUCY_QUERY); } else { CFISH_THROW(CFISH_ERR, "Bad type: '%s'", type_str); } - self = (lucy_ParserElem*)XSBind_new_blank_obj(either_sv); + self = (lucy_ParserElem*)XSBind_new_blank_obj(aTHX_ either_sv); self = lucy_ParserElem_init(self, type, value); - RETVAL = XSBind_cfish_to_perl((cfish_Obj*)self); + RETVAL = XSBind_cfish_to_perl(aTHX_ (cfish_Obj*)self); CFISH_DECREF(self); } OUTPUT: RETVAL http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/perl/buildlib/Lucy/Build/Binding/Util.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Util.pm b/perl/buildlib/Lucy/Build/Binding/Util.pm index 592e24c..952990a 100644 --- a/perl/buildlib/Lucy/Build/Binding/Util.pm +++ b/perl/buildlib/Lucy/Build/Binding/Util.pm @@ -154,7 +154,7 @@ latest_snapshot(folder) CODE: { cfish_String *latest = lucy_IxFileNames_latest_snapshot(folder); - RETVAL = XSBind_str_to_sv(latest); + RETVAL = XSBind_str_to_sv(aTHX_ latest); CFISH_DECREF(latest); } OUTPUT: RETVAL http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/perl/xs/Lucy/Analysis/RegexTokenizer.c ---------------------------------------------------------------------- diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c index 40ff0b7..d2ad616 100644 --- a/perl/xs/Lucy/Analysis/RegexTokenizer.c +++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c @@ -25,13 +25,14 @@ #include "Clownfish/Util/StringHelper.h" static SV* -S_compile_token_re(cfish_String *pattern); +S_compile_token_re(pTHX_ cfish_String *pattern); static void -S_set_token_re_but_not_pattern(lucy_RegexTokenizer *self, void *token_re); +S_set_token_re_but_not_pattern(pTHX_ lucy_RegexTokenizer *self, + void *token_re); static void -S_set_pattern_from_token_re(lucy_RegexTokenizer *self, void *token_re); +S_set_pattern_from_token_re(pTHX_ lucy_RegexTokenizer *self, void *token_re); bool lucy_RegexTokenizer_is_available(void) { @@ -59,21 +60,22 @@ lucy_RegexTokenizer_init(lucy_RegexTokenizer *self, } // Acquire a compiled regex engine for matching one token. - SV *token_re_sv = S_compile_token_re(ivars->pattern); - S_set_token_re_but_not_pattern(self, SvRV(token_re_sv)); + dTHX; + SV *token_re_sv = S_compile_token_re(aTHX_ ivars->pattern); + S_set_token_re_but_not_pattern(aTHX_ self, SvRV(token_re_sv)); SvREFCNT_dec(token_re_sv); return self; } static SV* -S_compile_token_re(cfish_String *pattern) { +S_compile_token_re(pTHX_ cfish_String *pattern) { dSP; ENTER; SAVETMPS; EXTEND(SP, 1); PUSHMARK(SP); - XPUSHs(XSBind_str_to_sv(pattern)); + XPUSHs(XSBind_str_to_sv(aTHX_ pattern)); PUTBACK; call_pv("Lucy::Analysis::RegexTokenizer::_compile_token_re", G_SCALAR); SPAGAIN; @@ -86,7 +88,8 @@ S_compile_token_re(cfish_String *pattern) { } static void -S_set_token_re_but_not_pattern(lucy_RegexTokenizer *self, void *token_re) { +S_set_token_re_but_not_pattern(pTHX_ lucy_RegexTokenizer *self, + void *token_re) { lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self); #if (PERL_VERSION > 10) REGEXP *rx = SvRX((SV*)token_re); @@ -110,7 +113,7 @@ S_set_token_re_but_not_pattern(lucy_RegexTokenizer *self, void *token_re) { } static void -S_set_pattern_from_token_re(lucy_RegexTokenizer *self, void *token_re) { +S_set_pattern_from_token_re(pTHX_ lucy_RegexTokenizer *self, void *token_re) { lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self); SV *rv = newRV((SV*)token_re); STRLEN len = 0; @@ -123,13 +126,15 @@ S_set_pattern_from_token_re(lucy_RegexTokenizer *self, void *token_re) { void LUCY_RegexTokenizer_Set_Token_RE_IMP(lucy_RegexTokenizer *self, void *token_re) { - S_set_token_re_but_not_pattern(self, token_re); + dTHX; + S_set_token_re_but_not_pattern(aTHX_ self, token_re); // Set pattern as a side effect. - S_set_pattern_from_token_re(self, token_re); + S_set_pattern_from_token_re(aTHX_ self, token_re); } void LUCY_RegexTokenizer_Destroy_IMP(lucy_RegexTokenizer *self) { + dTHX; lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self); CFISH_DECREF(ivars->pattern); ReREFCNT_dec(((REGEXP*)ivars->token_re)); @@ -140,6 +145,7 @@ void LUCY_RegexTokenizer_Tokenize_Utf8_IMP(lucy_RegexTokenizer *self, const char *string, size_t string_len, lucy_Inversion *inversion) { + dTHX; lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self); uint32_t num_code_points = 0; SV *wrapper = sv_newmortal(); http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/perl/xs/Lucy/Document/Doc.c ---------------------------------------------------------------------- diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c index 398bcd8..9f9f5fe 100644 --- a/perl/xs/Lucy/Document/Doc.c +++ b/perl/xs/Lucy/Document/Doc.c @@ -23,6 +23,7 @@ lucy_Doc* lucy_Doc_init(lucy_Doc *self, void *fields, int32_t doc_id) { + dTHX; lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); // Assign. if (fields) { @@ -39,6 +40,7 @@ lucy_Doc_init(lucy_Doc *self, void *fields, int32_t doc_id) { void LUCY_Doc_Set_Fields_IMP(lucy_Doc *self, void *fields) { + dTHX; lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); if (ivars->fields) { SvREFCNT_dec((SV*)ivars->fields); } ivars->fields = SvREFCNT_inc((SV*)fields); @@ -46,12 +48,14 @@ LUCY_Doc_Set_Fields_IMP(lucy_Doc *self, void *fields) { uint32_t LUCY_Doc_Get_Size_IMP(lucy_Doc *self) { + dTHX; lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); return ivars->fields ? HvKEYS((HV*)ivars->fields) : 0; } void LUCY_Doc_Store_IMP(lucy_Doc *self, cfish_String *field, cfish_Obj *value) { + dTHX; lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); const char *key = CFISH_Str_Get_Ptr8(field); size_t key_size = CFISH_Str_Get_Size(field); @@ -59,7 +63,7 @@ LUCY_Doc_Store_IMP(lucy_Doc *self, cfish_String *field, cfish_Obj *value) { SV *val_sv = value == NULL ? newSV(0) : CFISH_Obj_Is_A(value, CFISH_STRING) - ? XSBind_str_to_sv((cfish_String*)value) + ? XSBind_str_to_sv(aTHX_ (cfish_String*)value) : (SV*)CFISH_Obj_To_Host(value); SvUTF8_on(key_sv); (void)hv_store_ent((HV*)ivars->fields, key_sv, val_sv, 0); @@ -68,7 +72,7 @@ LUCY_Doc_Store_IMP(lucy_Doc *self, cfish_String *field, cfish_Obj *value) { } static SV* -S_nfreeze_fields(lucy_Doc *self) { +S_nfreeze_fields(pTHX_ lucy_Doc *self) { lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); dSP; ENTER; @@ -89,9 +93,10 @@ S_nfreeze_fields(lucy_Doc *self) { void LUCY_Doc_Serialize_IMP(lucy_Doc *self, lucy_OutStream *outstream) { + dTHX; lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); LUCY_OutStream_Write_C32(outstream, ivars->doc_id); - SV *frozen = S_nfreeze_fields(self); + SV *frozen = S_nfreeze_fields(aTHX_ self); STRLEN len; char *buf = SvPV(frozen, len); LUCY_OutStream_Write_C64(outstream, len); @@ -100,7 +105,7 @@ LUCY_Doc_Serialize_IMP(lucy_Doc *self, lucy_OutStream *outstream) { } static HV* -S_thaw_fields(lucy_InStream *instream) { +S_thaw_fields(pTHX_ lucy_InStream *instream) { // Read frozen data into an SV buffer. size_t len = (size_t)LUCY_InStream_Read_C64(instream); SV *buf_sv = newSV(len + 1); @@ -134,8 +139,9 @@ S_thaw_fields(lucy_InStream *instream) { lucy_Doc* LUCY_Doc_Deserialize_IMP(lucy_Doc *self, lucy_InStream *instream) { + dTHX; int32_t doc_id = (int32_t)LUCY_InStream_Read_C32(instream); - HV *fields = S_thaw_fields(instream); + HV *fields = S_thaw_fields(aTHX_ instream); lucy_Doc_init(self, fields, doc_id); SvREFCNT_dec(fields); return self; @@ -143,12 +149,13 @@ LUCY_Doc_Deserialize_IMP(lucy_Doc *self, lucy_InStream *instream) { cfish_Obj* LUCY_Doc_Extract_IMP(lucy_Doc *self, cfish_String *field) { + dTHX; lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); cfish_Obj *retval = NULL; SV **sv_ptr = hv_fetch((HV*)ivars->fields, CFISH_Str_Get_Ptr8(field), CFISH_Str_Get_Size(field), 0); - if (sv_ptr && XSBind_sv_defined(*sv_ptr)) { + if (sv_ptr && XSBind_sv_defined(aTHX_ *sv_ptr)) { SV *const sv = *sv_ptr; if (sv_isobject(sv) && sv_derived_from(sv, "Clownfish::Obj")) { IV tmp = SvIV(SvRV(sv)); @@ -166,15 +173,17 @@ LUCY_Doc_Extract_IMP(lucy_Doc *self, cfish_String *field) { void* LUCY_Doc_To_Host_IMP(lucy_Doc *self) { + dTHX; LUCY_Doc_To_Host_t super_to_host = CFISH_SUPER_METHOD_PTR(LUCY_DOC, LUCY_Doc_To_Host); SV *perl_obj = (SV*)super_to_host(self); - XSBind_enable_overload(perl_obj); + XSBind_enable_overload(aTHX_ perl_obj); return perl_obj; } cfish_Hash* LUCY_Doc_Dump_IMP(lucy_Doc *self) { + dTHX; lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); cfish_Hash *dump = cfish_Hash_new(0); CFISH_Hash_Store_Utf8(dump, "_class", 6, @@ -182,12 +191,13 @@ LUCY_Doc_Dump_IMP(lucy_Doc *self) { CFISH_Hash_Store_Utf8(dump, "doc_id", 7, (cfish_Obj*)cfish_Str_newf("%i32", ivars->doc_id)); CFISH_Hash_Store_Utf8(dump, "fields", 6, - XSBind_perl_to_cfish((SV*)ivars->fields)); + XSBind_perl_to_cfish(aTHX_ (SV*)ivars->fields)); return dump; } lucy_Doc* LUCY_Doc_Load_IMP(lucy_Doc *self, cfish_Obj *dump) { + dTHX; cfish_Hash *source = (cfish_Hash*)CFISH_CERTIFY(dump, CFISH_HASH); cfish_String *class_name = (cfish_String*)CFISH_CERTIFY( CFISH_Hash_Fetch_Utf8(source, "_class", 6), @@ -200,7 +210,7 @@ LUCY_Doc_Load_IMP(lucy_Doc *self, cfish_Obj *dump) { cfish_Hash *fields = (cfish_Hash*)CFISH_CERTIFY( CFISH_Hash_Fetch_Utf8(source, "fields", 6), CFISH_HASH); - SV *fields_sv = XSBind_cfish_to_perl((cfish_Obj*)fields); + SV *fields_sv = XSBind_cfish_to_perl(aTHX_ (cfish_Obj*)fields); CFISH_UNUSED_VAR(self); lucy_DocIVARS *const loaded_ivars = lucy_Doc_IVARS(loaded); @@ -222,6 +232,7 @@ LUCY_Doc_Equals_IMP(lucy_Doc *self, cfish_Obj *other) { if (!!ivars->fields ^ !!ovars->fields) { return false; } // Verify fields. Don't allow any deep data structures. + dTHX; HV *my_fields = (HV*)ivars->fields; HV *other_fields = (HV*)ovars->fields; if (HvKEYS(my_fields) != HvKEYS(other_fields)) { return false; } @@ -242,7 +253,10 @@ LUCY_Doc_Equals_IMP(lucy_Doc *self, cfish_Obj *other) { void LUCY_Doc_Destroy_IMP(lucy_Doc *self) { lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self); - if (ivars->fields) { SvREFCNT_dec((SV*)ivars->fields); } + if (ivars->fields) { + dTHX; + SvREFCNT_dec((SV*)ivars->fields); + } CFISH_SUPER_DESTROY(self, LUCY_DOC); } http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/perl/xs/Lucy/Index/DocReader.c ---------------------------------------------------------------------- diff --git a/perl/xs/Lucy/Index/DocReader.c b/perl/xs/Lucy/Index/DocReader.c index 90a929e..d725887 100644 --- a/perl/xs/Lucy/Index/DocReader.c +++ b/perl/xs/Lucy/Index/DocReader.c @@ -29,6 +29,7 @@ lucy_HitDoc* LUCY_DefDocReader_Fetch_Doc_IMP(lucy_DefaultDocReader *self, int32_t doc_id) { + dTHX; lucy_DefaultDocReaderIVARS *const ivars = lucy_DefDocReader_IVARS(self); lucy_Schema *const schema = ivars->schema; lucy_InStream *const dat_in = ivars->dat_in; http://git-wip-us.apache.org/repos/asf/lucy/blob/6c78b530/perl/xs/Lucy/Index/Inverter.c ---------------------------------------------------------------------- diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c index 4c3cd4e..ab63e4c 100644 --- a/perl/xs/Lucy/Index/Inverter.c +++ b/perl/xs/Lucy/Index/Inverter.c @@ -29,7 +29,7 @@ #include "Clownfish/Util/StringHelper.h" static lucy_InverterEntry* -S_fetch_entry(lucy_Inverter *self, HE *hash_entry) { +S_fetch_entry(pTHX_ lucy_Inverter *self, HE *hash_entry) { lucy_InverterIVARS *const ivars = lucy_Inverter_IVARS(self); lucy_Schema *const schema = ivars->schema; char *key; @@ -79,6 +79,7 @@ S_fetch_entry(lucy_Inverter *self, HE *hash_entry) { void LUCY_Inverter_Invert_Doc_IMP(lucy_Inverter *self, lucy_Doc *doc) { + dTHX; HV *const fields = (HV*)LUCY_Doc_Get_Fields(doc); I32 num_keys = hv_iterinit(fields); @@ -88,7 +89,7 @@ LUCY_Inverter_Invert_Doc_IMP(lucy_Inverter *self, lucy_Doc *doc) { // Extract and invert the doc's fields. while (num_keys--) { HE *hash_entry = hv_iternext(fields); - lucy_InverterEntry *inv_entry = S_fetch_entry(self, hash_entry); + lucy_InverterEntry *inv_entry = S_fetch_entry(aTHX_ self, hash_entry); SV *value_sv = HeVAL(hash_entry); lucy_InverterEntryIVARS *const entry_ivars = lucy_InvEntry_IVARS(inv_entry);
