本文整理汇总了C++中SvREFCNT_dec函数的典型用法代码示例。如果您正苦于以下问题:C++ SvREFCNT_dec函数的具体用法?C++ SvREFCNT_dec怎么用?C++ SvREFCNT_dec使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SvREFCNT_dec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LUCY_Doc_Set_Fields_IMP
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);
}
示例2: decode_tuple
void decode_tuple(pTHX_ unsigned char *input, STRLEN len, struct cc_type *type, SV *output)
{
SV *the_rv;
AV *the_tuple;
struct cc_tuple *tuple;
int i;
STRLEN pos;
the_tuple = newAV();
the_rv = newRV_noinc((SV*)the_tuple);
sv_setsv(output, the_rv);
SvREFCNT_dec(the_rv);
tuple = type->tuple;
assert(tuple);
pos = 0;
for (i = 0; i < tuple->field_count; i++) {
struct cc_type *type = &tuple->fields[i];
SV *decoded = newSV(0);
av_push(the_tuple, decoded);
decode_cell(aTHX_ input, len, &pos, type, decoded);
}
}
示例3: LUCY_Doc_Load_IMP
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),
CFISH_STRING);
cfish_Class *klass = cfish_Class_singleton(class_name, NULL);
lucy_Doc *loaded = (lucy_Doc*)CFISH_Class_Make_Obj(klass);
cfish_Obj *doc_id = CFISH_CERTIFY(
CFISH_Hash_Fetch_Utf8(source, "doc_id", 7),
CFISH_OBJ);
cfish_Hash *fields = (cfish_Hash*)CFISH_CERTIFY(
CFISH_Hash_Fetch_Utf8(source, "fields", 6),
CFISH_HASH);
SV *fields_sv = XSBind_cfish_to_perl(aTHX_ (cfish_Obj*)fields);
CFISH_UNUSED_VAR(self);
lucy_DocIVARS *const loaded_ivars = lucy_Doc_IVARS(loaded);
loaded_ivars->doc_id = (int32_t)lucy_Json_obj_to_i64(doc_id);
loaded_ivars->fields = SvREFCNT_inc(SvRV(fields_sv));
SvREFCNT_dec(fields_sv);
return loaded;
}
示例4: lucy_RegexTokenizer_init
lucy_RegexTokenizer*
lucy_RegexTokenizer_init(lucy_RegexTokenizer *self,
const lucy_CharBuf *pattern) {
SV *token_re_sv;
lucy_Analyzer_init((lucy_Analyzer*)self);
#define DEFAULT_PATTERN "\\w+(?:['\\x{2019}]\\w+)*"
if (pattern) {
if (Lucy_CB_Find_Str(pattern, "\\p", 2) != -1
|| Lucy_CB_Find_Str(pattern, "\\P", 2) != -1
) {
CFISH_DECREF(self);
THROW(LUCY_ERR, "\\p and \\P constructs forbidden");
}
self->pattern = Lucy_CB_Clone(pattern);
}
else {
self->pattern = lucy_CB_new_from_trusted_utf8(
DEFAULT_PATTERN, sizeof(DEFAULT_PATTERN) - 1);
}
// Acquire a compiled regex engine for matching one token.
token_re_sv = (SV*)lucy_Host_callback_host(
LUCY_REGEXTOKENIZER, "compile_token_re", 1,
CFISH_ARG_STR("pattern", self->pattern));
S_set_token_re_but_not_pattern(self, SvRV(token_re_sv));
SvREFCNT_dec(token_re_sv);
return self;
}
示例5: sv_to_dimension
static long sv_to_dimension(pTHX_ SV *sv, const char *member)
{
SV *warning;
const char *value = NULL;
assert(sv != NULL);
SvGETMAGIC(sv);
if (SvOK(sv) && !SvROK(sv))
{
if (looks_like_number(sv))
{
return SvIV(sv);
}
value = SvPV_nolen(sv);
}
warning = newSVpvn("", 0);
if (value) sv_catpvf(warning, " ('%s')", value);
if (member) sv_catpvf(warning, " in '%s'", member);
WARN((aTHX_ "Cannot use %s%s as dimension", identify_sv(sv), SvPV_nolen(warning)));
SvREFCNT_dec(warning);
return 0;
}
示例6: decode_list
void decode_list(pTHX_ unsigned char *input, STRLEN len, struct cc_type *type, SV *output)
{
struct cc_type *inner_type;
int i;
AV *the_list;
SV *the_rv;
STRLEN pos;
inner_type = type->inner_type;
assert(inner_type);
if (UNLIKELY(len < 4))
croak("decode_list: len < 4");
int32_t num_elements = (int32_t)ntohl(*(uint32_t*)(input));
if (UNLIKELY(num_elements < 0))
croak("decode_list: num_elements < 0");
the_list = newAV();
the_rv = newRV_noinc((SV*)the_list);
sv_setsv(output, the_rv);
SvREFCNT_dec(the_rv);
pos = 4;
for (i = 0; i < num_elements; i++) {
SV *decoded = newSV(0);
av_push(the_list, decoded);
decode_cell(aTHX_ input, len, &pos, inner_type, decoded);
}
}
示例7: destroy_cmd_handler
static void
destroy_cmd_handler(PurplePerlCmdHandler *handler)
{
purple_cmd_unregister(handler->id);
cmd_handlers = g_slist_remove(cmd_handlers, handler);
if (handler->callback != NULL)
SvREFCNT_dec(handler->callback);
if (handler->data != NULL)
SvREFCNT_dec(handler->data);
g_free(handler->cmd);
g_free(handler->prpl_id);
g_free(handler);
}
示例8: coroae_int
static void coroae_int(void) {
uwsgi_log("Brutally killing worker %d (pid: %d)...\n", uwsgi.mywid, uwsgi.mypid);
uwsgi.workers[uwsgi.mywid].manage_next_request = 0;
SvREFCNT_dec(ucoroae.watchers);
coroae_condvar_call(ucoroae.condvar, "send");
}
示例9: perl_substitute__
/*----------------------------------------------------------------------------
perl_substitute__()
The pattern substitution function which includes loading perl interpreter
and doing the pattern substitution, then returning the replaced string.
arguments:
input: char* string, input text
char* pattern, match pattern
output:char* string, output text
----------------------------------------------------------------------------*/
int perl_substitute__( void )
{
SV *text; /* Perl representation for the string to be
modified by substitution */
char *subst_cmd = ptoc_string(2);
int i;
/* first load the perl interpreter, if unloaded */
if (perlObjectStatus == UNLOADED) load_perl__();
text = newSV(0);
sv_setpv(text, ptoc_string(1)); /* put the string to the SV */
if( !substitute(&text, subst_cmd) )
return(FAILURE);
global_pattern_mode = is_global_pattern(subst_cmd);
if (substituteString != NULL ) free(substituteString);
substituteString = malloc(strlen(SvPV(text,PL_na))+1);
strcpy(substituteString,SvPV(text,PL_na));
SvREFCNT_dec(text); /*release space*/
ctop_string(3, string_find(substituteString,1)); /*return changed text*/
return SUCCESS;
}
示例10: RS_discardPerlForeignReference
USER_OBJECT_
RS_discardPerlForeignReference(USER_OBJECT_ obj)
{
const char *key;
USER_OBJECT_ ans = NEW_LOGICAL(1);
#ifndef USE_NEW_PERL_REFERENCES
if(IS_CHARACTER(obj)) {
key = CHAR_DEREF(STRING_ELT(obj, 0));
} else {
key = CHAR_DEREF(STRING_ELT(VECTOR_ELT(obj, 0), 0));
}
LOGICAL_DATA(ans)[0] = discardPerlForeignReference(key, NULL);
#else
SV *el;
dTHX;
el = getForeignPerlReference(obj);
if(el) {
SvREFCNT_dec(obj);
LOGICAL_DATA(ans)[0] = 1;
}
#endif
return(ans);
}
示例11: destroy_prefs_handler
static void
destroy_prefs_handler(PurplePerlPrefsHandler *handler)
{
pref_handlers = g_slist_remove(pref_handlers, handler);
if (handler->iotag > 0)
purple_prefs_disconnect_callback(handler->iotag);
if (handler->callback != NULL)
SvREFCNT_dec(handler->callback);
if (handler->data != NULL)
SvREFCNT_dec(handler->data);
g_free(handler);
}
示例12: decode_udt
void decode_udt(pTHX_ unsigned char *input, STRLEN len, struct cc_type *type, SV *output)
{
struct cc_udt *udt;
int i;
STRLEN pos;
HV *the_obj;
SV *the_rv;
the_obj = newHV();
the_rv = newRV_noinc((SV*)the_obj);
sv_setsv(output, the_rv);
SvREFCNT_dec(the_rv);
udt = type->udt;
assert(udt && udt->fields);
pos = 0;
for (i = 0; i < udt->field_count; i++) {
if (len == pos) {
break;
}
struct cc_udt_field *field;
SV *value;
field = &udt->fields[i];
value = newSV(0);
hv_store_ent(the_obj, field->name, value, field->name_hash);
decode_cell(aTHX_ input, len, &pos, &field->type, value);
}
}
示例13: newPerlPyObject_noinc
SV*
newPerlPyObject_noinc(PyObject *pyo)
{
SV* rv;
SV* sv;
MAGIC *mg;
dCTXP;
ASSERT_LOCK_PERL;
if (!pyo)
croak("Missing pyo reference argument");
rv = newSV(0);
sv = newSVrv(rv, "Python::Object");
sv_setiv(sv, (IV)pyo);
sv_magic(sv, 0, '~', 0, 0);
mg = mg_find(sv, '~');
if (!mg) {
SvREFCNT_dec(rv);
croak("Can't assign magic to Python::Object");
}
mg->mg_virtual = &vtbl_free_pyo;
SvREADONLY(sv);
#ifdef REF_TRACE
printf("Bind pyo %p\n", pyo);
#endif
ASSERT_LOCK_PERL;
return rv;
}
示例14: kharon_perl_free
KHARON_DECL void
kharon_perl_free(ssp_val *ret)
{
D(fprintf(stderr, "decrementing ref count on %p\n", *ret));
SvREFCNT_dec(*ret);
}
示例15: fatal
void fatal(const char *f, ...)
{
dTHX;
va_list l;
SV *sv = newSVpvn("", 0);
va_start(l, f);
sv_catpv(sv,
"============================================\n"
" FATAL ERROR in " XSCLASS "!\n"
"--------------------------------------------\n"
);
sv_vcatpvf(sv, f, &l);
sv_catpv(sv,
"\n"
"--------------------------------------------\n"
" please report this error to [email protected]\n"
"============================================\n"
);
va_end(l);
fprintf(stderr, "%s", SvPVX(sv));
SvREFCNT_dec(sv);
abort();
}