• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ decref函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中decref函数的典型用法代码示例。如果您正苦于以下问题:C++ decref函数的具体用法?C++ decref怎么用?C++ decref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了decref函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: push_instruction_list

void push_instruction_list(machine * m,
                           oyster * ins,
                           table * scope, table * scope_below)
{
    incref(ins);

    frame *top = NULL;
    frame **cur = ⊤
    while (!nilp(ins)) {
        (*cur) = make_frame(NULL,
                            scope, NULL, scope_below, car(ins), EVALUATE);
        incref(*cur);

        cur = &((*cur)->below);

        oyster *ins2 = cdr(ins);
        incref(ins2);
        decref(ins);
        ins = ins2;
    }

    decref(ins);
    (*cur) = m->current_frame;
    m->current_frame = top;
}
开发者ID:agumonkey,项目名称:Tainted-Oyster,代码行数:25,代码来源:frame.c


示例2: extrarw

static long
extrarw(int write, Chan *c, void *a, long n, vlong off)
{
	int i;
	SDrw *f;
	SDev *sdev;
	SDunit *unit;

	sdev = sdgetdev(DEV(c->qid));
	if(sdev == nil)
		error(Enonexist);
	if(waserror()){
		decref(&sdev->r);
		nexterror();
	}
	unit = sdev->unit[UNIT(c->qid)];
	if(unit->vers != c->qid.vers)
		error(Echange);
	unit = sdev->unit[UNIT(c->qid)];
	i = PART(c->qid);
	if(i >= unit->nefile)
		error(Enonexist);
	f = unit->efile[i].r;
	if(write)
		f = unit->efile[i].w;
	if(i >= unit->nefile || f == nil)
		error(Eperm);
	n = f(unit, c, a, n, off);
	poperror();
	decref(&sdev->r);
	return n;
}
开发者ID:srk-cmu,项目名称:9problems,代码行数:32,代码来源:devsd.c


示例3: stack_trace_free

void stack_trace_free(stack_trace *t)
{
    decref(t->function);
    decref(t->remove_when);
    decref(t->below);
    free(t);
}
开发者ID:strcrzy,项目名称:Tainted-Oyster,代码行数:7,代码来源:machine.c


示例4: main

int main (int argc, char *argv[])
{
    big_pyobj *f, *freevars;
    int i;


    /**
     * test1: simple closure with no free vars
     * f = lambda x: x
     * decref(list)
     */
    pymem_init();
    freevars = create_list(inject_int(0));
    incref(freevars);

    f = create_closure(dummy_function, inject_big(freevars));
    incref(f);
    assert (freevars->ref_ctr == 2);

    decref(f);
    assert (freevars->ref_ctr == 1);

    decref(freevars);

    pymem_print_stats();
    pymem_shutdown();
}
开发者ID:smitten0000,项目名称:ecen5523,代码行数:27,代码来源:closure.c


示例5: consclose

void
consclose(Chan *c)
{
	if((c->flag & COPEN) == 0)
		return;

	switch((ulong)c->qid.path) {
	case Qconsctl:
		if(decref(&kbd.ctl) == 0)
			kbd.raw = 0;
		break;
	case Qpointer:
		decref(&kbd.ptr);
		break;
	case Qscancode:
		qlock(&kbd.gq);
		if(gkscanq) {
			qfree(gkscanq);
			gkscanq = 0;
		}
		qunlock(&kbd.gq);
		break;
	case Qkprint:
		wlock(&kprintq.l);
		qfree(kprintq.q);
		kprintq.q = nil;
		wunlock(&kprintq.l);
		break;
	case Qsnarf:
		if(c->mode == OWRITE)
			clipwrite(c->aux, strlen(c->aux));
		free(c->aux);
		break;
	}
}
开发者ID:caerwynj,项目名称:inferno-lab,代码行数:35,代码来源:devcons.c


示例6: sdattach

static Chan*
sdattach(char* spec)
{
	Chan *c;
	char *p;
	SDev *sdev;
	int idno, subno;

	if(*spec == '\0'){
		c = devattach(sddevtab.dc, spec);
		mkqid(&c->qid, QID(0, 0, 0, Qtopdir), 0, QTDIR);
		return c;
	}

	if(spec[0] != 's' || spec[1] != 'd')
		error(Ebadspec);
	idno = spec[2];
	subno = strtol(&spec[3], &p, 0);
	if(p == &spec[3])
		error(Ebadspec);

	if((sdev=sdgetdev(idno)) == nil)
		error(Enonexist);
	if(sdgetunit(sdev, subno) == nil){
		decref(&sdev->r);
		error(Enonexist);
	}

	c = devattach(sddevtab.dc, spec);
	mkqid(&c->qid, QID(sdev->idno, subno, 0, Qunitdir), 0, QTDIR);
	c->dev = (sdev->idno << UnitLOG) + subno;
	decref(&sdev->r);
	return c;
}
开发者ID:Mekapaedia,项目名称:inferno-rpi,代码行数:34,代码来源:devsd.c


示例7: sdwstat

static int
sdwstat(Chan* c, uchar* dp, int n)
{
	Dir *d;
	SDpart *pp;
	SDperm *perm;
	SDunit *unit;
	SDev *sdev;

	if(c->qid.type & QTDIR)
		error(Eperm);

	sdev = sdgetdev(DEV(c->qid));
	if(sdev == nil)
		error(Enonexist);
	unit = sdev->unit[UNIT(c->qid)];
	qlock(&unit->ctl);
	d = nil;
	if(waserror()){
		free(d);
		qunlock(&unit->ctl);
		decref(&sdev->r);
		nexterror();
	}

	switch(TYPE(c->qid)){
	default:
		error(Eperm);
	case Qctl:
		perm = &unit->ctlperm;
		break;
	case Qraw:
		perm = &unit->rawperm;
		break;
	case Qpart:
		pp = &unit->part[PART(c->qid)];
		if(unit->vers+pp->vers != c->qid.vers)
			error(Enonexist);
		perm = &pp->SDperm;
		break;
	}

	if(strcmp(up->env->user, perm->user) && !iseve())
		error(Eperm);

	d = smalloc(sizeof(Dir)+n);
	n = convM2D(dp, n, &d[0], (char*)&d[1]);
	if(n == 0)
		error(Eshortstat);
	if(!emptystr(d[0].uid))
		kstrdup(&perm->user, d[0].uid);
	if(d[0].mode != ~0UL)
		perm->perm = (perm->perm & ~0777) | (d[0].mode & 0777);

	free(d);
	qunlock(&unit->ctl);
	decref(&sdev->r);
	poperror();
	return n;
}
开发者ID:Mekapaedia,项目名称:inferno-rpi,代码行数:60,代码来源:devsd.c


示例8: pass1

static void
pass1(int pass, volatile Diag *dp)
{
	int i;

	if(m->machno == 0)
		iprint(" %d", pass);
	for (i = 1000*1000; --i > 0; ) {
		incref(&dp->cnt);
		incref(&dp->cnt);
	}

	synccpus(&dp->sync, navailcpus);
	/* all cpus are now here */

	ilock(dp);
	if(dp->cnt.ref != 0)
		panic("cpu%d: diag: failed w count %ld", m->machno, dp->cnt.ref);
	iunlock(dp);

	synccpus(&dp->sync, 2 * navailcpus);
	/* all cpus are now here */
	decref(&dp->sync);
	decref(&dp->sync);
}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:25,代码来源:archtegra.c


示例9: is_match_pike

int is_match_pike(struct Prog* prog,char* input, char** subp) {
  char* sp;
  struct Sub* sub;
  struct Inst* pc;
  int matched = 0;
  struct ThreadList *clist, *nlist, *tlist;
  int len = prog->len;
  clist = threadlist(len);
  nlist = threadlist(len);
  gen++;
  sub = newsub();
  int i;
  for(i = 0; i < MAXSUB; i++)
    sub->sub[i] = NULL;
  addthread(clist, thread(prog->start, sub), input);
  for(sp = input; ; sp++) {
    if(clist->n == 0)
      break;
    gen++;
    for(i = 0; i < clist->n; i++) {
      pc = clist->t[i].pc;
      sub = clist->t[i].sub;
      switch(pc->opcode) {
        case Char:
          if(*sp != pc->c) {
            decref(sub);
	    break;
	  }
          //printf("%c", pc->c);
	case Any:
	  if(*sp == '\0') {
	    decref(sub);
	    break;
	  }
          addthread(nlist, thread(pc+1, sub), sp+1);
          break;
        case Match:
          matched = 1;
	  int i;
	  for(i = 0; i < MAXSUB; i++)
	    subp[i] = sub->sub[i];
          for(i = 0; i < clist->n; i++)
	    decref(clist->t[i].sub);
	  goto BreakFor;
       }
     }
    //printf("\n");
    BreakFor:
             tlist = clist;
	     clist = nlist;
	     nlist = tlist;
	     nlist->n = 0;
	     if(sp == '\0')
	       break;
  }
  if(matched)
    return sp - input;
            return 0;
}
开发者ID:nnabeyang,项目名称:regexp_vm,代码行数:59,代码来源:pike.c


示例10: machine_free

void machine_free(machine * x)
{
    decref(x->base_frame);
    decref(x->current_frame);
    decref(x->now);
    decref(x->accumulator);
    free(x);
}
开发者ID:strcrzy,项目名称:Tainted-Oyster,代码行数:8,代码来源:machine.c


示例11: frame_free

void frame_free(frame * x)
{
    decref(x->below);
    
    decref(x->scope);
    decref(x->scope_to_be);
    decref(x->scope_below);
    
    decref(x->instruction);
    free(x);
}
开发者ID:agumonkey,项目名称:Tainted-Oyster,代码行数:11,代码来源:frame.c


示例12: cleanup

void
cleanup(void)
{
	if(P == nil)
		return;

	remproc(P);
	decref(&nproc);
	freesegs();
	fddecref(P->fd);
	if(P->path != nil && decref(P->path) == 0)
		free(P->path);
	free(P);
}
开发者ID:Nurb432,项目名称:plan9front,代码行数:14,代码来源:5e.c


示例13: sdopen

static Chan*
sdopen(Chan* c, int omode)
{
	SDpart *pp;
	SDunit *unit;
	SDev *sdev;
	uchar tp;

	c = devopen(c, omode, 0, 0, sdgen);
	if((tp = TYPE(c->qid)) != Qctl && tp != Qraw && tp != Qpart)
		return c;

	sdev = sdgetdev(DEV(c->qid));
	if(sdev == nil)
		error(Enonexist);

	unit = sdev->unit[UNIT(c->qid)];

	switch(TYPE(c->qid)){
	case Qctl:
		c->qid.vers = unit->vers;
		break;
	case Qraw:
		c->qid.vers = unit->vers;
		if(tas(&unit->rawinuse) != 0){
			c->flag &= ~COPEN;
			decref(&sdev->r);
			error(Einuse);
		}
		unit->state = Rawcmd;
		break;
	case Qpart:
		qlock(&unit->ctl);
		if(waserror()){
			qunlock(&unit->ctl);
			c->flag &= ~COPEN;
			decref(&sdev->r);
			nexterror();
		}
		pp = &unit->part[PART(c->qid)];
		c->qid.vers = unit->vers+pp->vers;
		qunlock(&unit->ctl);
		poperror();
		break;
	}
	decref(&sdev->r);
	return c;
}
开发者ID:Mekapaedia,项目名称:inferno-rpi,代码行数:48,代码来源:devsd.c


示例14: winclose

void
winclose(Win *w)
{
	if(w->f == nil){
		cmdprint("?\n");
		return;
	}
	if(!decref(w->f)){
		if(w->f->change > 0){
			cmdprint("?\n");
			incref(w->f);
			w->f->change = -1;
			return;
		}
		putfil(w->f);
		w->f = nil;
	}
	freeimage(w->im);
	if(w->f != nil){
		w->wnext->wprev = w->wprev;
		w->wprev->wnext = w->wnext;
	}
	w->next->prev = w->prev;
	w->prev->next = w->next;
	if(w == actw)
		actw = nil;
	if(w == actf)
		actf = nil;
	free(w);
}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:30,代码来源:win.c


示例15: closepgrp

void
closepgrp(Pgrp *p)
{
	Mhead **h, **e, *f, *next;

	if(decref(&p->ref) != 0)
		return;

	qlock(&p->debug);
	wlock(&p->ns);
	p->pgrpid = -1;

	e = &p->mnthash[MNTHASH];
	for(h = p->mnthash; h < e; h++) {
		for(f = *h; f; f = next) {
			wlock(&f->lock);
			cclose(f->from);
			mountfree(f->mount);
			f->mount = nil;
			next = f->hash;
			wunlock(&f->lock);
			putmhead(f);
		}
	}
	wunlock(&p->ns);
	qunlock(&p->debug);
	free(p);
}
开发者ID:0intro,项目名称:drawterm,代码行数:28,代码来源:pgrp.c


示例16: consclose

static void
consclose(Chan *c)
{
	if((c->flag & COPEN) == 0)
		return;

	switch((ulong)c->qid.path) {
	case Qconsctl:
		/* last close of control file turns off raw */
		if(decref(&kbd.ctl) == 0)
			kbd.raw = 0;
		break;

	case Qscancode:
		qlock(&kbd.gq);
		if(gkscanq) {
			qfree(gkscanq);
			gkscanq = nil;
		}
		qunlock(&kbd.gq);
		break;

	case Qkprint:
		wlock(&kprintq.l);
		qfree(kprintq.q);
		kprintq.q = nil;
		wunlock(&kprintq.l);
		break;
	}
}
开发者ID:Mekapaedia,项目名称:inferno-rpi,代码行数:30,代码来源:devcons.c


示例17: pgfree

void
pgfree(Page* pg)
{
	decref(&pga.pgsza[pg->pgszi].npages);
	physfree(pg->pa, sys->pgsz[pg->pgszi]);
	free(pg);
}
开发者ID:aahud,项目名称:harvey,代码行数:7,代码来源:page.c


示例18: main

int main(int argc, char *argv[])
{
    init_oyster();

    FILE *file;
    int print;
    if (argc == 1) {
        file = stdin;
        print = 1;
    } else {
        file = fopen(argv[1], "r");
        print = 0;
    }
    if (errno) {
        error(errno, errno, "File error");
    }

    /// g'damn g_scanner won't return a token until EOF is reached.
    /// all my trickery is for naught.
    oyster *ret = evaluate_file(file, print);
    decref(ret);


    clean_up_oyster();

    return 0;

}
开发者ID:agumonkey,项目名称:Tainted-Oyster,代码行数:28,代码来源:tainted.c


示例19: set_accumulator

void set_accumulator(machine * m, oyster * value)
{
    oyster *t = m->accumulator;
    m->accumulator = value;
    incref(m->accumulator);
    decref(t);
}
开发者ID:strcrzy,项目名称:Tainted-Oyster,代码行数:7,代码来源:machine.c


示例20: ipclose

void
ipclose(Chan *c)
{
	Conv *cc;

	switch(TYPE(c->qid)) {
	case Qcs:
		csclose(c);
		break;
	case Qdata:
	case Qctl:
		if((c->flag & COPEN) == 0)
			break;
		cc = proto[PROTO(c->qid)].conv[CONV(c->qid)];
		if(decref(&cc->r) != 0)
			break;
		strcpy(cc->owner, "network");
		cc->perm = 0666;
		cc->state = "Closed";
		cc->laddr = 0;
		cc->raddr = 0;
		cc->lport = 0;
		cc->rport = 0;
		close(cc->sfd);
		break;
	}
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:27,代码来源:devip.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ decrement函数代码示例发布时间:2022-05-30
下一篇:
C++ decrRefCount函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap