当前位置: 首页>>代码示例>>C++>>正文


C++ SvREFCNT_dec函数代码示例

本文整理汇总了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);
}
开发者ID:pombredanne,项目名称:apache-lucy,代码行数:7,代码来源:Doc.c

示例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);
    }
}
开发者ID:TvdW,项目名称:perl-DBD-Cassandra,代码行数:26,代码来源:decode.c

示例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;
}
开发者ID:pombredanne,项目名称:apache-lucy,代码行数:25,代码来源:Doc.c

示例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;
}
开发者ID:pavansondur,项目名称:lucy,代码行数:30,代码来源:RegexTokenizer.c

示例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;
}
开发者ID:gitpan,项目名称:Convert-Binary-C,代码行数:29,代码来源:dimension.c

示例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);
    }
}
开发者ID:TvdW,项目名称:perl-DBD-Cassandra,代码行数:32,代码来源:decode.c

示例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);
}
开发者ID:dylex,项目名称:pidgin,代码行数:16,代码来源:perl-handlers.c

示例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");
}
开发者ID:Perkville,项目名称:uwsgi,代码行数:7,代码来源:coroae.c

示例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;
}
开发者ID:eden,项目名称:navajoverb,代码行数:37,代码来源:xsbpattern.c

示例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);
}
开发者ID:sboehringer,项目名称:RSPerl,代码行数:29,代码来源:Converters.c

示例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);
}
开发者ID:dylex,项目名称:pidgin,代码行数:16,代码来源:perl-handlers.c

示例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);
    }
}
开发者ID:TvdW,项目名称:perl-DBD-Cassandra,代码行数:34,代码来源:decode.c

示例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;
}
开发者ID:nikicat,项目名称:python-perlmodule,代码行数:33,代码来源:pyo.c

示例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);
}
开发者ID:nicowilliams,项目名称:kharon,代码行数:7,代码来源:arrayhash_perl.c

示例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();
}
开发者ID:gitpan,项目名称:Convert-Binary-C,代码行数:31,代码来源:util.c


注:本文中的SvREFCNT_dec函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。