您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unref函数代码示例

51自学网 2021-06-03 09:11:29
  C++
这篇教程C++ unref函数代码示例写得很实用,希望能帮到您。

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

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

示例1: do_fork

static NODE *do_fork(int nargs){	int ret = -1;	NODE **aptr;	NODE *tmp;	if  (do_lint && get_curfunc_arg_count() > 0)		lintwarn("fork: called with too many arguments");	ret = fork();	if (ret < 0)		update_ERRNO();	else if (ret == 0) {		/* update PROCINFO in the child */		aptr = assoc_lookup(PROCINFO_node, tmp = make_string("pid", 3), FALSE);		(*aptr)->numbr = (AWKNUM) getpid();		unref(tmp);		aptr = assoc_lookup(PROCINFO_node, tmp = make_string("ppid", 4), FALSE);		(*aptr)->numbr = (AWKNUM) getppid();		unref(tmp);	}	/* Set the return value */	return make_number((AWKNUM) ret);}
开发者ID:LediKorsar,项目名称:gawk,代码行数:29,


示例2: finc_run_string

void finc_run_string(FinC* self, unsigned char* str){    FinCNode* l_node;    String* l_str;    FinCParser* parser;    parser = finc_parser_new();    finc_parser_set_env(parser, self->env);    l_str = string_new_str(str);		finc_parser_parser_string(parser, l_str);    l_node =  addref(FinCNode, parser->tree_root);    unref(parser);    if ( g_finc_context->error !=0 )    {		printf("/t%d error founded, stopped.../n", g_finc_context->error);		unref(l_node);		return;    }    if (l_node)    {		finc_node_evaluate (l_node);		unref (l_node);    }}
开发者ID:guolilong2012,项目名称:study,代码行数:27,


示例3: finc_struct_destroy

void finc_struct_destroy(Object* self){    unref(((FinCStruct*)self)->name);    unref(((FinCStruct*)self)->hash_field);    mem_destroy (self);}
开发者ID:guolilong2012,项目名称:study,代码行数:7,


示例4: list_clear

void list_clear(List* self){	RealList* l_reallist = (RealList*)self;	ListNode* l_stand = l_reallist->head;	while ( l_stand )	{		if ( l_stand->next )		{			l_stand=l_stand->next;			unref(l_stand->prev->data);			mem_destroy(l_stand->prev);		}		else		{			unref(l_stand->data);			mem_destroy(l_stand);			break;		}	}	l_reallist->length=0;	l_reallist->head=NULL;	l_reallist->tail=NULL;	l_reallist->current=NULL;}
开发者ID:guolilong2012,项目名称:study,代码行数:26,


示例5: z_object_cleanup_attached_properties

static void  z_object_cleanup_attached_properties(Self *self){{ ZVector *attached_properties = (ZVector *) selfp->attached_properties; if (attached_properties) { ZVectorIter *it, *end; /* iterate through all attached properties */ it = z_vector_get_begin(attached_properties); end = z_vector_get_end(attached_properties); for (; !z_vector_iter_is_equal(it, end); z_vector_iter_increment(it)) { /* the vector contains a list of maps that has a pointer to 'self'.				   our goal is to remove 'self' from the map */ ZMap *map = (ZMap *) z_vector_get_item(attached_properties, it); /* remove the pointer */ ZMapIter *x = z_map_find(map, self); z_map_erase1(map, x); unref(Z_OBJECT(x)); } unref(Z_OBJECT(end)); unref(Z_OBJECT(it)); unref(Z_OBJECT(attached_properties)); selfp->attached_properties = NULL; } }}
开发者ID:rawnak,项目名称:honeycomb,代码行数:32,


示例6: wrap_uv_write

// params: stream, stringToWrite, afterWriteCallback(status)//LUA_API int wrap_uv_write(lua_State *L) {    uv_stream_t *stream;    uv_stream_t **stream_p = luaL_checkudata(L, 1, "uv_stream_t_ptr");    stream = *stream_p;    size_t slen = 0;    char *s = (char *) luaL_checklstring(L, 2, &slen);    if (s == NULL || slen <= 0) {        lua_pushinteger(L, 0);        return 1;    }    write_req_t *wr = malloc(sizeof(*wr));    if (wr != NULL) {        lua_pushvalue(L, 2);        wr->ref_buf = ref(L);        wr->ref_cb = ref_function(L, 3);        if (wr->ref_buf && wr->ref_cb) {            wr->buf = uv_buf_init(s, slen);            int res = uv_write(&wr->req, stream, &wr->buf, 1,                               wrap_uv_on_write);            lua_pushinteger(L, res);            return 1;        }        unref(wr->ref_buf);        unref(wr->ref_cb);        free(wr);    }    luaL_error(L, "wrap_uv_write malloc failed");    return 0;}
开发者ID:steveyen,项目名称:uv,代码行数:36,


示例7: z_object_disconnect

void  z_object_disconnect(Self *self,char *name,void *key){{ assert(selfp->signal_map != NULL); /* locate signal's closure list by name */ ZMap *signal_map = (ZMap *) selfp->signal_map; ZMapIter *map_iter = z_map_find(signal_map, name); assert(map_iter != NULL); ZVector *closure_list = z_map_get_value(signal_map, map_iter); unref(Z_OBJECT(map_iter)); /* remove the closure from the list */ ZVectorIter *it = z_vector_get_begin(closure_list); ZVectorIter *end = z_vector_get_end(closure_list); while (!z_vector_iter_is_equal(it, end)) { void *current_key = z_vector_get_item(closure_list, it); if (current_key == key) { z_vector_erase1(closure_list, it); break; } else { z_vector_iter_increment(it); } } unref(Z_OBJECT(end)); unref(Z_OBJECT(it)); unref(self); }}
开发者ID:rawnak,项目名称:honeycomb,代码行数:33,


示例8: start

	virtual void	start(Runnable *runnable, bool detached, bool runnableShouldBeFreed) throw(ThreadException) {		this->runnable = runnable;		this->detached = detached;		this->runnableShouldBeFreed = runnableShouldBeFreed;		if (detached) {			pthread_attr_t attr;			if (pthread_attr_init(&attr) != 0) {				throw ThreadException("Cannot initialize pthread attribute.");			}			if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0) {				throw ThreadException("Cannot set pthread detach state.");			}			ref();			if (pthread_create(&thread, &attr, entry, this) != 0) {				unref();				throw ThreadException("Cannot create a thread.");			}			pthread_attr_destroy(&attr);		} else {			ref();			if (pthread_create(&thread, NULL, entry, this) != 0) {				unref();				throw ThreadException("Cannot create a thread.");			}		}	}
开发者ID:NonPlayerCharactor,项目名称:cn-rag-client,代码行数:28,


示例9: free_filter

void free_filter(struct filter *f) {    if (f == NULL)        return;    assert(f->ref == 0);    unref(f->next, filter);    unref(f->glob, string);    free(f);}
开发者ID:llou,项目名称:libheracles,代码行数:8,


示例10: free_transform

void free_transform(struct transform *xform) {    if (xform == NULL)        return;    assert(xform->ref == 0);    unref(xform->lens, lens);    unref(xform->filter, filter);    free(xform);}
开发者ID:llou,项目名称:libheracles,代码行数:8,


示例11: finc_exit

void finc_exit(FinC* self){    unref(self->env);    unref(self->sys_func);    unref(self->context);    mem_destroy(self);}
开发者ID:guolilong2012,项目名称:study,代码行数:8,


示例12: load_READLINE

static voidload_READLINE(NODE *symbol, void *data){	sdata_t *sd = (sdata_t *) data;	NODE *file, *tmp;	FILE *fp;	static char linebuf[BUFSIZ];	int i;	bool long_line = false;	if (! sd->load_file)	/* non-existent SYS["readline"] or already loaded */ 		return;	file = sd->filename;	force_string(file);	if (file->stlen == 0)		return;	assoc_clear(symbol);	if ((fp = fopen(file->stptr, "r" )) == NULL) {		warning(_("READLINE (%s): %s"), file->stptr, strerror(errno));		return;	}	for (i = 1; fgets(linebuf, sizeof(linebuf), fp ) != NULL; i++) {		NODE **lhs;		size_t sz;		sz = strlen(linebuf);		if (sz > 0 && linebuf[sz - 1] == '/n') {			linebuf[sz - 1] = '/0';			sz--;			if (long_line) {				long_line = false;				i--;				continue;			}		} else if (long_line) {			i--;			continue;		} else {			if (do_lint)				lintwarn(_("file `%s' does not end in newline or line # `%d' is too long"),					file->stptr, i);			long_line = true;		}		tmp = make_number(i);		lhs = assoc_lookup(symbol, tmp);		unref(tmp);		unref(*lhs);		*lhs = make_string(linebuf, sz);	}	fclose(fp);	sd->load_file = false;	/* don't load this file again */}	
开发者ID:Distrotech,项目名称:gawk,代码行数:58,


示例13: TRACE

/** * Writes as much as it wouldn't block of the response stream into the underlying socket. * */bool HttpConnection::writeSome(){	TRACE("writeSome()");	ref();	ssize_t rv = output_.sendto(sink_);	TRACE("writeSome(): sendto().rv=%ld %s", rv, rv < 0 ? strerror(errno) : "");	if (rv > 0) {		// output chunk written		request_->bytesTransmitted_ += rv;		goto done;	}	if (rv == 0) {		// output fully written		watchInput();		if (request_->isFinished()) {			// finish() got invoked before reply was fully sent out, thus,			// finalize() was delayed.			request_->finalize();		}		TRACE("writeSome: output fully written. closed:%d, outputPending:%ld, refCount:%d", isClosed(), output_.size(), refCount_);		if (isClosed() && !isOutputPending() && refCount_ == 0) {			worker_->release(handle_);		}		goto done;	}	// sendto() failed	switch (errno) {	case EINTR:		break;	case EAGAIN:#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)	case EWOULDBLOCK:#endif		// complete write would block, so watch write-ready-event and be called back		watchOutput();		break;	default:		//log(Severity::error, "Connection write error: %s", strerror(errno));		goto err;	}done:	unref();	return true;err:	abort();	unref();	return false;}
开发者ID:crnt,项目名称:x0,代码行数:62,


示例14: free_regexp

void free_regexp(struct regexp *regexp) {    if (regexp == NULL)        return;    assert(regexp->ref == 0);    unref(regexp->info, info);    unref(regexp->pattern, string);    if (regexp->re != NULL) {        regfree(regexp->re);        free(regexp->re);    }    free(regexp);}
开发者ID:mchf,项目名称:augeas,代码行数:12,


示例15: operator

 result_type operator () (ast::operand const & _lhs, ast::operand const & _rhs) const {     auto const compile_ = [&] (auto const & l, auto const & r) -> result_type     {         return compile(l, r);     };     if (!multivisit(compile_, *unref(_lhs), *unref(_rhs))) {         return false;     }     return true; }
开发者ID:tomilov,项目名称:insituc,代码行数:12,


示例16: load_old_ext

NODE *load_old_ext(SRCFILE *s, const char *init_func, const char *fini_func, NODE *obj){	NODE *(*func)(NODE *, void *);	NODE *tmp;	void *dl;	int flags = RTLD_LAZY;	int *gpl_compat;	const char *lib_name = s->fullpath;	if (init_func == NULL || init_func[0] == '/0')		init_func = OLD_INIT_FUNC;	if (fini_func == NULL || fini_func[0] == '/0')		fini_func = OLD_FINI_FUNC;	if (do_sandbox)		fatal(_("extensions are not allowed in sandbox mode"));	if (do_traditional || do_posix)		fatal(_("`extension' is a gawk extension"));	if (lib_name == NULL)		fatal(_("extension: received NULL lib_name"));	if ((dl = dlopen(lib_name, flags)) == NULL)		fatal(_("extension: cannot open library `%s' (%s)"), lib_name,		      dlerror());	/* Per the GNU Coding standards */	gpl_compat = (int *) dlsym(dl, "plugin_is_GPL_compatible");	if (gpl_compat == NULL)		fatal(_("extension: library `%s': does not define `plugin_is_GPL_compatible' (%s)"),				lib_name, dlerror());	func = (NODE *(*)(NODE *, void *)) dlsym(dl, init_func);	if (func == NULL)		fatal(_("extension: library `%s': cannot call function `%s' (%s)"),				lib_name, init_func, dlerror());	if (obj == NULL) {		obj = make_string(lib_name, strlen(lib_name));		tmp = (*func)(obj, dl);		unref(tmp);		unref(obj);		tmp = NULL;	} else		tmp = (*func)(obj, dl);	s->fini_func = (void (*)(void)) dlsym(dl, fini_func);	return tmp;}
开发者ID:infoburp,项目名称:gawk,代码行数:51,


示例17: wrap_uv_on_write

static void wrap_uv_on_write(uv_write_t *req, int status) {    write_req_t *wr = (write_req_t *) req;    assert(wr && wr->ref_cb && wr->ref_cb->L);    lua_rawgeti(wr->ref_cb->L, LUA_REGISTRYINDEX, wr->ref_cb->ref);    lua_pushnumber(wr->ref_cb->L, status);    if (lua_pcall(wr->ref_cb->L, 1, 0, 0) != 0) {        printf("wrap_uv_on_write pcall error: %s/n",               lua_tostring(wr->ref_cb->L, -1));    }    unref(wr->ref_buf);    unref(wr->ref_cb);    free(wr);}
开发者ID:steveyen,项目名称:uv,代码行数:14,


示例18: PairStream

// setSlotComponent() -- Sets a single componentbool Component::setSlotComponent(Component* const single){   // When a only one component ... make it a PairStream   const auto pairStream = new PairStream();   const auto pair = new Pair("1", single);   pairStream->put( pair );   pair->unref();   // Process the new components list and swap   processComponents(pairStream, typeid(Component));   pairStream->unref();   return true;}
开发者ID:doughodson,项目名称:OpenEaagles,代码行数:15,


示例19: Matrix

// Returns a pre-ref'd pointer to the inverse of this matrix, or zero// if the matrix can not be invertedMatrix* Matrix::getInvLU() const{   if (!isGoodMatrix() || !isSquare()) return nullptr;   const unsigned int N = rows;   const auto pL = new Matrix(N,N);   const auto pU = new Matrix(N,N);   getLU(pL, pU);   const auto pB = new Matrix(N,N);   pB->makeIdent();   const auto pY = new Matrix(N,N);   const auto pX = new Matrix(N,N);   //-------------------------------------------------------   // find Y from LY = I using forward substitution   //-------------------------------------------------------   for (unsigned int i = 0; i < N; i++) {      for (unsigned int j = 0; j < N; j++) {         (*pY)(i,j) = (*pB)(i,j);         for (unsigned int k = 0; k < i; k++) {            (*pY)(i,j) -= (*pL)(i,k) * (*pY)(k,j);         }      }   }   //-------------------------------------------------------   // find X from UX = Y using back substitution   //-------------------------------------------------------   for (int i = (N-1); i >= 0; i--)   {      for (unsigned int j = 0; j < N; j++) {         (*pX)(i,j) = (*pY)(i,j);         for (int k = (N-1); k > i; k--) {            (*pX)(i,j) -= (*pU)(i,k) * (*pX)(k,j);         }         (*pX)(i,j) /= (*pU)(i,i);      }   }   pL->unref();   pU->unref();   pB->unref();   pY->unref();   return pX;}
开发者ID:doughodson,项目名称:OpenEaagles,代码行数:50,


示例20: gtk_widget_destroy

voidGtkNoCodecsUI::Close (){	gtk_widget_destroy (dialog);	unref ();	running = false;}
开发者ID:snorp,项目名称:moon,代码行数:7,


示例21: unref

	Coll Coll::operator=( const Coll& src )	{		unref();		coll_ = src.coll_;		ref();		return *this;	}
开发者ID:randalboyle,项目名称:xmms2-devel,代码行数:7,


示例22: main

int main(int argc, char**argv){      int err;    sqlite3 *conn;    char *errmsg;        err = sqlite3_open("test.sl3",&conn);    Table *t = table_new(TableCsv | TableColumns);        err = sqlite3_exec(conn,"select * from test",        table_add_row,t,&errmsg);        if (err) {        printf("err '%s'/n",errmsg);        return 1;    }    table_finish_rows(t);        DUMPA(float,(float*)t->cols[1],"%f");      sqlite3_close(conn);    unref(t);        DI(obj_kount());    return 0;}
开发者ID:stevedonovan,项目名称:llib,代码行数:28,


示例23: main

int main(int argc,  const char **argv){    ArgState *state = arg_command_line(args,argv);    if (! interactive) {        if (array_len(incdirs) > 0) {            printf("the include paths/n");            FOR_ARR (str_t,P,incdirs)                printf("'%s'/n",*P);        }        if (array_len(string_args) > 0) {            printf("the string args/n");            FOR_ARR (str_t,P,string_args)                printf("'%s'/n",*P);        }        printf("flag a is %d/n",a);    } else {        char *line;            printf("> ");        while ((line = file_getline(stdin)) != NULL) {            char **parts = str_split(line," ");            // args_process assumes args start at second element, hence -1 here            PValue v = arg_process(state,(const char**)parts-1);            if (v != NULL) {                printf("%s/n",value_tostring(v));                unref(v);            }            dispose(parts,line);            printf("> ");            arg_reset_used(state);        }            }    return 0;}
开发者ID:stevedonovan,项目名称:llib,代码行数:33,


示例24: list_remove_current

void list_remove_current(List* self){	RealList* l_reallist = (RealList*)self;	ListNode* l_stand;	if ( l_reallist->current == NULL )return ;	l_stand = l_reallist->current;	if ( l_stand->prev )		l_stand->prev->next = l_stand->next;	else		l_reallist->head = l_stand->next;	if ( l_stand->next )	{		l_stand->next->prev = l_stand->prev;		l_reallist->current = l_stand->next;	}	else	{		l_reallist->tail = l_stand->prev;		l_reallist->current = l_stand->prev;	}	unref(l_stand->data);	mem_destroy(l_stand);	l_reallist->length--;}
开发者ID:guolilong2012,项目名称:study,代码行数:29,


示例25: throw_stopiter

void throw_stopiter(){    if (fg->error != VALUE_NULL) {        unref(fg->error);    }    fg->error = vp_Value(ref_new(fs->cls_stopiter));}
开发者ID:x768,项目名称:fox-lang,代码行数:7,


示例26: ref

void MAPM::copyFrom(M_APM Nval) {	 M_APM oldVal=myVal;	 myVal=Nval;	 ref(myVal);	 unref(oldVal);}
开发者ID:xubingyue,项目名称:xqilla,代码行数:7,


示例27: builder

// endpoint builderEndpoint* builder(const std::string& filename){   // read configuration file   unsigned int num_errors = 0;   oe::base::Object* obj = oe::base::edl_parser(filename, factory, &num_errors);   if (num_errors > 0) {      std::cerr << "File: " << filename << ", number of errors: " << num_errors << std::endl;      std::exit(EXIT_FAILURE);   }   // test to see if an object was created   if (obj == nullptr) {      std::cerr << "Invalid configuration file, no objects defined!" << std::endl;      std::exit(EXIT_FAILURE);   }   // do we have a base::Pair, if so, point to object in Pair, not Pair itself   const auto pair = dynamic_cast<oe::base::Pair*>(obj);   if (pair != nullptr) {      obj = pair->object();      obj->ref();      pair->unref();   }   // try to cast to proper object, and check   const auto endpoint = dynamic_cast<Endpoint*>(obj);   if (endpoint == nullptr) {      std::cerr << "Invalid configuration file!" << std::endl;      std::exit(EXIT_FAILURE);   }   return endpoint;}
开发者ID:doughodson,项目名称:OpenEaaglesExamples,代码行数:33,



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


C++ unref_dlg函数代码示例
C++ unreachable函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。