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


C++ UNREF函数代码示例

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


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

示例1: t_unref

int t_unref( struct sip_msg* p_msg  )
{
	enum kill_reason kr;

	if (T==T_UNDEFINED || T==T_NULL_CELL)
		return -1;
	if (p_msg->first_line.type==SIP_REQUEST){
		kr=get_kr();
		if (kr==0 
				||(p_msg->REQ_METHOD==METHOD_ACK && !(kr & REQ_RLSD))) {
			LOG(L_WARN, "WARNING: script writer didn't release transaction\n");
			t_release_transaction(T);
		}
	}
	UNREF( T );
	set_t(T_UNDEFINED);
	return 1;
}
开发者ID:winer632,项目名称:openimscore-code,代码行数:18,代码来源:t_lookup.c

示例2: gotnetpkt

/// Test routine called when an otherwise-unclaimed NetIO packet is received.
gboolean
gotnetpkt(Listener* l,		///<[in/out] Input GSource
	  FrameSet* fs,		///<[in/out] @ref FrameSet "FrameSet"s received
	  NetAddr* srcaddr	///<[in] Source address of this packet
	  )
{
	(void)l; (void)srcaddr;
	++wirepktcount;
	switch(fs->fstype) {
	case FRAMESETTYPE_HBDEAD:
		g_message("CMA Received dead host notification (type %d) over the 'wire'."
		,	  fs->fstype);
		break;
	case FRAMESETTYPE_SWDISCOVER:
		g_message("CMA Received switch discovery data (type %d) over the 'wire'."
		,	  fs->fstype);
		break;
	case FRAMESETTYPE_JSDISCOVERY:
		g_message("CMA Received JSON discovery data (type %d) over the 'wire'."
		,	  fs->fstype);
		check_JSON(fs);
		break;
	case FRAMESETTYPE_RSCOPREPLY:
		g_message("CMA Received resource operation data (type %d) over the 'wire'."
		,	  fs->fstype);
		check_JSON(fs);
		break;
	default:{
			char *	fsstr = fs->baseclass.toString(&fs->baseclass);
			g_message("CMA Received a FrameSet of type %d [%s] over the 'wire'."
			,	  fs->fstype, fsstr);
			FREE(fsstr); fsstr = NULL;
		}
	}
	
	l->transport->_netio->ackmessage(l->transport->_netio, srcaddr, fs);
	UNREF(fs);
	if (wirepktcount >= maxpkts) {
		g_message("QUITTING NOW - wirepktcount!");
		nano_initiate_shutdown();
		return FALSE;
	}
	return TRUE;
}
开发者ID:JJediny,项目名称:assimilation-official,代码行数:45,代码来源:pcap+mainloop.c

示例3: w_t_lookup_cancel

inline static int w_t_lookup_cancel(struct sip_msg* msg, char* str, char* str2)
{
	struct cell *ret;
	if (msg->REQ_METHOD==METHOD_CANCEL) {
		ret = t_lookupOriginalT( msg );
		DBG("lookup_original: t_lookupOriginalT returned: %p\n", ret);
		if (ret != T_NULL_CELL) {
			/* The cell is reffed by t_lookupOriginalT, but T is not set.
			So we must unref it before returning. */
			UNREF(ret);
			set_t(T_UNDEFINED);
			return 1;
		}
		set_t(T_UNDEFINED);
	} else {
		LOG(L_WARN, "WARNING: script error t_lookup_cancel() called for non-CANCEL request\n");
	}
	return -1;
}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:19,代码来源:tm.c

示例4: RmDirCB

/**
 * FILE_RmDir callback. Recursively destroys the directory contents
 */
STATIC Bool RmDirCB(Str dir, Str fname, void * ctx) 
{
    Bool ok = False;
    StrBuf64 path;
    UNREF(ctx);
    STRBUF_InitBufXXX(&path);
    if (STRBUF_Copy(&path.sb, dir) && 
        STRBUF_AppendChar(&path.sb, FILE_SEPARATOR_CHAR) &&
        STRBUF_Append(&path.sb, fname)) {
        ok = True;
        if (FILE_IsDir(path.sb.s)) {
            FILE_RmDir(path.sb.s, True);
        } else {
            FILE_Delete(path.sb.s);
        }
    }
    STRBUF_Destroy(&path.sb);
    return ok;
}
开发者ID:aharrison24,项目名称:HAL,代码行数:22,代码来源:s_futil.c

示例5: UNREF

const StringId ServerIntangibleObjectTemplate::_SchematicAttribute::getName(bool versionOk, bool testData) const
{
#ifdef _DEBUG
StringId testDataValue = DefaultStringId;
#else
UNREF(testData);
#endif

	const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL;
	if (m_baseData != NULL)
	{
		base = dynamic_cast<const ServerIntangibleObjectTemplate::_SchematicAttribute *>(m_baseData);
#ifdef _DEBUG
		if (testData && base != NULL)
			testDataValue = base->getName(true);
#endif
	}

	if (!m_name.isLoaded())
	{
		if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL)
		{
			DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName()));
			return DefaultStringId;
		}
		else
		{
			DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName()));
			return base->getName(versionOk);
		}
	}

	const StringId value = m_name.getValue();
#ifdef _DEBUG
	if (testData && base != NULL)
	{
	}
#endif

	return value;
}	// ServerIntangibleObjectTemplate::_SchematicAttribute::getName
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:41,代码来源:ServerIntangibleObjectTemplate.cpp

示例6: UNREF

const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName(bool testData) const
{
#ifdef _DEBUG
std::string testDataValue = DefaultString;
#else
UNREF(testData);
#endif

	const SharedShipObjectTemplate * base = NULL;
	if (m_baseData != NULL)
	{
		base = dynamic_cast<const SharedShipObjectTemplate *>(m_baseData);
#ifdef _DEBUG
		if (testData && base != NULL)
			testDataValue = base->getInteriorLayoutFileName(true);
#endif
	}

	if (!m_interiorLayoutFileName.isLoaded())
	{
		if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
		{
			DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName()));
			return DefaultString;
		}
		else
		{
			DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName()));
			return base->getInteriorLayoutFileName();
		}
	}

	const std::string & value = m_interiorLayoutFileName.getValue();
#ifdef _DEBUG
	if (testData && base != NULL)
	{
	}
#endif

	return value;
}	// SharedShipObjectTemplate::getInteriorLayoutFileName
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:41,代码来源:SharedShipObjectTemplate.cpp

示例7: t_check_trans

inline static int t_check_trans(struct sip_msg* msg)
{
	struct cell *trans;

	if (msg->REQ_METHOD==METHOD_CANCEL) {
		/* parse needed hdrs*/
		if (check_transaction_quadruple(msg)==0) {
			LM_ERR("too few headers\n");
			return 0; /*drop request!*/
		}
		if (!msg->hash_index)
			msg->hash_index = tm_hash(msg->callid->body,get_cseq(msg)->number);
		/* performe lookup */
		trans = t_lookupOriginalT(  msg );
		return trans?1:-1;
	} else {
		trans = get_t();
		if (trans==NULL)
			return -1;
		if (trans!=T_UNDEFINED)
			return 1;
		switch ( t_lookup_request( msg , 0) ) {
			case 1:
				/* transaction found -> is it local ACK? */
				if (msg->REQ_METHOD==METHOD_ACK)
					return 1;
				/* .... else -> retransmission */
				trans = get_t();
				t_retransmit_reply(trans);
				UNREF(trans);
				set_t(0);
				return 0;
			case -2:
				/* e2e ACK found */
				return 1;
			default:
				/* notfound */
				return -1;
		}
	}
}
开发者ID:Deni90,项目名称:opensips,代码行数:41,代码来源:tm.c

示例8: UNREF

//@BEGIN TFD
const std::string & ServerManufactureSchematicObjectTemplate::getDraftSchematic(bool testData) const
{
#ifdef _DEBUG
std::string testDataValue = DefaultString;
#else
UNREF(testData);
#endif

	const ServerManufactureSchematicObjectTemplate * base = NULL;
	if (m_baseData != NULL)
	{
		base = dynamic_cast<const ServerManufactureSchematicObjectTemplate *>(m_baseData);
#ifdef _DEBUG
		if (testData && base != NULL)
			testDataValue = base->getDraftSchematic(true);
#endif
	}

	if (!m_draftSchematic.isLoaded())
	{
		if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL)
		{
			DEBUG_WARNING(true, ("Returning default value for missing parameter draftSchematic in template %s", DataResource::getName()));
			return DefaultString;
		}
		else
		{
			DEBUG_FATAL(base == NULL, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName()));
			return base->getDraftSchematic();
		}
	}

	const std::string & value = m_draftSchematic.getValue();
#ifdef _DEBUG
	if (testData && base != NULL)
	{
	}
#endif

	return value;
}	// ServerManufactureSchematicObjectTemplate::getDraftSchematic
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:42,代码来源:ServerManufactureSchematicObjectTemplate.cpp

示例9: UNREF

/**
 * Writes the ending of a class header file.
 *
 * @param fp				the file to write to
 * @param sourceTemplate	the template we are writing code for
 */
void TemplateDefinitionFile::writeClassHeaderEnd(File &fp, const TemplateData & sourceTemplate) const
{
	UNREF(sourceTemplate);

	const char *name = getTemplateName().c_str();

	fp.print("\n");
	fp.print("private:\n");
	fp.print("\tTag  m_templateVersion;\t// the template version\n");
	fp.print("\tbool m_versionOk;\t// flag that the template version loaded is "
		"the one we expect\n");
	if (!m_writeForCompilerFlag)
		fp.print("\tstatic bool ms_allowDefaultTemplateParams;\t// flag to allow defaut params instead of fataling\n");
	fp.print("\n");
	fp.print("\tstatic void registerMe(void);\n");
	fp.print("\tstatic ObjectTemplate * create(const std::string & filename);\n");
	fp.print("\n");
	fp.print("\t// no copying\n");
	fp.print("\t%s(const %s &);\n", name, name);
	fp.print("\t%s & operator =(const %s &);\n", name, name);
	fp.print("};\n");
	fp.print("\n");
	fp.print("\n");
	if (m_writeForCompilerFlag)
	{
		fp.print("inline void %s::install(void)\n", name);
		fp.print("{\n");
	}
	else
	{
		fp.print("inline void %s::install(bool allowDefaultTemplateParams)\n", name);
		fp.print("{\n");
		fp.print("\tms_allowDefaultTemplateParams = allowDefaultTemplateParams;\n");
	}
	sourceTemplate.writeRegisterTemplate(fp, "\t");
	fp.print("}\n");
	fp.print("\n");
	fp.print("\n");
	fp.print("#endif\t// _INCLUDED_%s_H\n", name);
}	// TemplateDefinitionFile::writeClassHeaderEnd
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:46,代码来源:TemplateDefinitionFile.cpp

示例10: loadDataTables

	void loadDataTables()
	{
		FILE* fp = fopen("datatables.plf","r");
		char buf [256];
		if (fp)
		{
			DEBUG_REPORT_LOG(true, ("Scanning tables"));
			char* line = fgets(buf, 256, fp);
			while (line)
			{
				
				//strip newline
				int len = strlen(line);
				for (int i = len - 1; i > 0; --i)
				{
					if (buf[i] == '\n')
					{
						buf[i] = 0;
						break;
					}
				}
				
				char* tmp = strstr(buf, "datatables/");
				if (tmp)
					line = tmp;

				DataTable* dt =  DataTableManager::getTable(line, true);
#if 0
				if (dt)
					ms_dataTableList.push_back(dt);
#else
				UNREF(dt);
#endif
				DEBUG_REPORT_LOG(true, ("."));
				line = fgets(buf, 256, fp);
			}
			fclose(fp);
			DEBUG_REPORT_LOG(true, ("\n"));
		}
	}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:40,代码来源:PreloadManager.cpp

示例11: workspace_load_compat

gboolean
workspace_load_compat( Workspace *ws, int major, int minor )
{
	char pathname[FILENAME_MAX];
	GSList *path;
	int best_major;
	int best_minor;

	if( workspace_have_compat( major, minor, &best_major, &best_minor ) ) {
		/* Make a private toolkitgroup local to this workspace to 
		 * hold the compatibility defs we are planning to load.
		 */
		UNREF( ws->kitg );
		ws->kitg = toolkitgroup_new( ws->sym );
		g_object_ref( G_OBJECT( ws->kitg ) );
		iobject_sink( IOBJECT( ws->kitg ) );

		im_snprintf( pathname, FILENAME_MAX, 
			"$VIPSHOME/share/" PACKAGE "/compat/%d.%d", 
			best_major, best_minor );
		path = path_parse( pathname );
		if( path_map( path, "*.def", 
			(path_map_fn) workspace_load_toolkit, ws->kitg ) ) {
			path_free2( path );
			return( FALSE );
		}
		path_free2( path );

		ws->compat_major = best_major;
		ws->compat_minor = best_minor;
	}
	else {
		/* No compat defs necessary for this ws. 
		 */
		ws->compat_major = 0;
		ws->compat_minor = 0;
	}

	return( TRUE );
}
开发者ID:imclab,项目名称:nip2,代码行数:40,代码来源:workspace.c

示例12: rpc_cancel

/* fifo command to cancel a pending call (Uli)
 * Syntax:
 *
 * ":uac_cancel:[response file]\n
 * callid\n
 * cseq\n
 */
void rpc_cancel(rpc_t* rpc, void* c)
{
	struct cell *trans;
	static char cseq[128], callid[128];
	struct cancel_info cancel_data;
	int i,j;

	str cseq_s;   /* cseq */
	str callid_s; /* callid */

	cseq_s.s=cseq;
	callid_s.s=callid;
	init_cancel_info(&cancel_data);

	if (rpc->scan(c, "SS", &callid_s, &cseq_s) < 2) {
		rpc->fault(c, 400, "Callid and CSeq expected as parameters");
		return;
	}

	if( t_lookup_callid(&trans, callid_s, cseq_s) < 0 ) {
		DBG("Lookup failed\n");
		rpc->fault(c, 400, "Transaction not found");
		return;
	}
	/*  find the branches that need cancel-ing */
	prepare_to_cancel(trans, &cancel_data.cancel_bitmap, 0);
	 /* tell tm to cancel the call */
	DBG("Now calling cancel_uacs\n");
	i=cancel_uacs(trans, &cancel_data, 0); /* don't fake 487s, 
										 just wait for timeout */
	
	/* t_lookup_callid REF`d the transaction for us, we must UNREF here! */
	UNREF(trans);
	j=0;
	while(i){
		j++;
		i&=i-1;
	}
	rpc->add(c, "ds", j, "branches remaining (waiting for timeout)");
}
开发者ID:AndreyRybkin,项目名称:kamailio,代码行数:47,代码来源:t_cancel.c

示例13: UNREF

void JNICALL ScriptMethodsChatNamespace::chatSendSystemMessage(JNIEnv * env, jobject self, jstring _to, jstring _message, jstring _oob)
{
	UNREF(self);

	if (!_to)
		return;

	Unicode::String to;
	{
		const JavaStringParam jt(_to);
		if(!JavaLibrary::convert(jt, to))
			return;
	}

	Unicode::String message;

	if (_message)
	{
		const JavaStringParam jt(_message);
		if (!JavaLibrary::convert(jt, message))
			return;
	}

	Unicode::String oob;

	if (_oob)
	{
		const JavaStringParam jt(_oob);
		if (!JavaLibrary::convert(jt, oob))
			return;
	}

	if (message.empty () && oob.empty ())
	{
		DEBUG_WARNING (true, ("chatSendSystemMessage with empty message _and_ oob"));
	}

	Chat::sendSystemMessage(Unicode::wideToNarrow (to), message, oob);
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:39,代码来源:ScriptMethodsChat.cpp

示例14: XML_HandleEndElem

/**
 * "End element" callback for XML_Handle. If this tag has been "skipped" by
 * XML_StartElemCB, simply decrements skipDepth. Otherwise, calls the client
 * callback to deallocate the tag context.
 */
STATIC void XML_HandleEndElem(void * ctx, Str tag)
{
    XMLContext * context = (XMLContext*)ctx;
    UNREF(tag);
    if (context->error && context->skipDepth > 0) {
        context->skipDepth--;
    } else {    
        int depth = VECTOR_Size(&context->stack);
        ASSERT(depth > 0);
        if (depth == 1 && !context->error) {
            XMLTagCtx * root;
            root = (XMLTagCtx*)VECTOR_Get(&context->stack,0);
            ASSERT(root && root->context == context);
            ASSERT(!context->rootTag);

            /* prevent XML_VectorFreeTagContext from deallocating the tag */
            context->rootTag = root->tag;
            root->tag = NULL;
        }
        if (depth > 0) {
            VECTOR_Remove(&context->stack, depth-1);
        }
    }
}
开发者ID:fedor4ever,项目名称:packaging,代码行数:29,代码来源:s_xmlp.c

示例15: sizeof

/**
 * Saves the template data to an iff file.
 *
 * @param file			file to save to
 * @param location		file type (client or server)
 */
void ServerStaticObjectTemplate::save(Iff &file)
{
int count;

	file.insertForm(ServerStaticObjectTemplate_tag);
	if (m_baseTemplateName.size() != 0)
	{
		file.insertForm(TAG(D,E,R,V));
		file.insertChunk(TAG(X, X, X, X));
		file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1);
		file.exitChunk();
		file.exitForm();
	}
	file.insertForm(TAG(0,0,0,1));
	file.allowNonlinearFunctions();

	int paramCount = 0;

	// save clientOnlyBuildout
	file.insertChunk(TAG(X, X, X, X));
	file.insertChunkString("clientOnlyBuildout");
	m_clientOnlyBuildout.saveToIff(file);
	file.exitChunk();
	++paramCount;

	// write number of parameters
	file.goToTopOfForm();
	file.insertChunk(TAG(P, C, N, T));
	file.insertChunkData(&paramCount, sizeof(paramCount));
	file.exitChunk();

	file.exitForm(true);
	ServerObjectTemplate::save(file);
	file.exitForm();
	UNREF(count);
}	// ServerStaticObjectTemplate::save
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:42,代码来源:ServerStaticObjectTemplate.cpp


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