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

C++ IF_FREE函数代码示例

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

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



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

示例1: _mp_app_inotify_add_recursive_watch

void
_mp_app_inotify_add_recursive_watch(const char *path, void *ad)
{

	DIR *dp = NULL;
	struct dirent *entry = NULL;
	char *sub_path = NULL;
	sub_path = strdup(path);
	if (mp_app_inotify_add_watch(sub_path, _mp_app_inotify_cb, ad) < 0)
	{
		IF_FREE(sub_path);
		return;
	}

	dp = opendir(sub_path);
	if (dp == NULL)
		return;

	while ((entry = (struct dirent *)readdir(dp)) != NULL)
	{
		if (entry->d_name[0] == '.')
			continue;

		IF_FREE(sub_path);
		sub_path = g_strdup_printf("%s/%s", path, entry->d_name);
		if (entry->d_type == DT_DIR)
			_mp_app_inotify_add_recursive_watch(sub_path, ad);
	}
	IF_FREE(sub_path);

	closedir(dp);

}
开发者ID:minjinsong,项目名称:tizen-music-player,代码行数:33,代码来源:mp-app.c


示例2: ecore_exe_event_data_free

EAPI void
ecore_exe_event_data_free(Ecore_Exe_Event_Data *e)
{
   if (!e) return;
   IF_FREE(e->lines);
   IF_FREE(e->data);
   free(e);
}
开发者ID:Limsik,项目名称:e17,代码行数:8,代码来源:ecore_exe_win32.c


示例3: engrave_data_free

/**
 * engrave_data_free - free the given data block
 * @param ed: The Engrave_Data to free
 *
 * @return Returns no value.
 */
EAPI void
engrave_data_free(Engrave_Data *ed)
{
  if (!ed) return;

  IF_FREE(ed->key);
  IF_FREE(ed->value);
  FREE(ed);
}
开发者ID:playya,项目名称:Enlightenment,代码行数:15,代码来源:engrave_data.c


示例4: project_close

/**
 * close the current project
 */
static void
project_close( Ewler_Project *p )
{
	IF_FREE(p->name);
	IF_FREE(p->path);
	IF_FREE(p->filename);

	ecore_hash_destroy(p->files);
	FREE(p);
}
开发者ID:playya,项目名称:Enlightenment,代码行数:13,代码来源:project.c


示例5: _exml_node_destroy

static void _exml_node_destroy( void *data )
{
	EXML_Node *node = data;

	if (node) {
		ecore_hash_destroy(node->attributes);
		IF_FREE(node->tag);
		IF_FREE(node->value);
		ecore_list_destroy(node->children);

		FREE(node);
	}
}
开发者ID:playya,项目名称:Enlightenment,代码行数:13,代码来源:exml.c


示例6: startNode

void CViewSourceHTML::WriteTextInElement(const nsAString& tagName, 
                                         eHTMLTags tagType, const nsAString& text,
                                         nsTokenAllocator* allocator,
                                         const nsAString& attrName, 
                                         const nsAString& attrValue) {
  // Open the element, supplying the attribute, if any.
  nsTokenAllocator* theAllocator = mTokenizer->GetTokenAllocator();
  if (!theAllocator) {
    return;
  }

  CStartToken* startToken =
    static_cast<CStartToken*>
      (theAllocator->CreateTokenOfType(eToken_start, tagType, tagName));
  if (!startToken) {
    return;
  }

  nsCParserStartNode startNode(startToken, theAllocator);
  if (!attrName.IsEmpty()) {
    AddAttrToNode(startNode, allocator, attrName, attrValue);
  }
  mSink->OpenContainer(startNode);
  IF_FREE(startToken, theAllocator);

  // Add the text node.
  CTextToken textToken(text);
  nsCParserNode textNode(&textToken, 0/*stack token*/);
  mSink->AddLeaf(textNode);

  // Close the element.
  mSink->CloseContainer(tagType);
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:33,代码来源:nsViewSourceHTML.cpp


示例7: engrave_data_value_set

/**
 * engrave_data_value_set - set the value of the data object
 * @param ed: The Engrave_Data to set the value into
 * @param value: The value to set.
 * 
 * @return Returns no value.
 */
EAPI void
engrave_data_value_set(Engrave_Data *ed, const char *value)
{
    if (!ed) return;
    IF_FREE(ed->value);
    ed->value = (value ? strdup(value) : NULL);
}
开发者ID:playya,项目名称:Enlightenment,代码行数:14,代码来源:engrave_data.c


示例8: endToken

/**
 * Call this to start a new PRE block.  See bug 86355 for why this
 * makes some pages much faster.
 */
void CViewSourceHTML::StartNewPreBlock(void){
  CEndToken endToken(eHTMLTag_pre);
  nsCParserNode endNode(&endToken, 0/*stack token*/);
  mSink->CloseContainer(eHTMLTag_pre);

  nsTokenAllocator* theAllocator = mTokenizer->GetTokenAllocator();
  if (!theAllocator) {
    return;
  }

  CStartToken* theToken =
    static_cast<CStartToken*>
               (theAllocator->CreateTokenOfType(eToken_start,
                                                   eHTMLTag_pre,
                                                   NS_LITERAL_STRING("PRE")));
  if (!theToken) {
    return;
  }

  nsCParserStartNode startNode(theToken, theAllocator);
  AddAttrToNode(startNode, theAllocator,
                NS_LITERAL_STRING("id"),
                NS_ConvertASCIItoUTF16(nsPrintfCString("line%d", mLineNumber)));
  mSink->OpenContainer(startNode);
  IF_FREE(theToken, theAllocator);

#ifdef DUMP_TO_FILE
  if (gDumpFile) {
    fprintf(gDumpFile, "</pre>\n");
    fprintf(gDumpFile, "<pre id=\"line%d\">\n", mLineNumber);
  }
#endif // DUMP_TO_FILE

  mTokenCount = 0;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:39,代码来源:nsViewSourceHTML.cpp


示例9: IF_FREE

/**
 * This method is called just after a known text char has
 * been consumed and we should read a text run. Note: we actually ignore the
 * first character of the text run so that we can consume invalid markup 
 * as text.
 *  
 * @param aToken The OUT parameter that holds our resulting token.
 * @param aScanner Our source of data
 * @return Error result.
 */ 
nsresult
nsHTMLTokenizer::ConsumeText(CToken*& aToken, nsScanner& aScanner)
{
  nsresult result = NS_OK;
  nsTokenAllocator* theAllocator = this->GetTokenAllocator();
  CTextToken* theToken =
    (CTextToken*)theAllocator->CreateTokenOfType(eToken_text, eHTMLTag_text);
  if (theToken) {
    PRUnichar ch = '\0';
    result = theToken->Consume(ch, aScanner, mFlags);
    if (NS_FAILED(result)) {
      if (0 == theToken->GetTextLength()) {
        IF_FREE(aToken, mTokenAllocator);
        aToken = nullptr;
      } else {
        result = NS_OK;
      }
    }

    aToken = theToken;
    AddToken(aToken, result, &mTokenDeque, theAllocator);
  }

  return result;
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:35,代码来源:nsHTMLTokenizer.cpp


示例10: sp_view_mgr_pop_view_content

void
sp_view_mgr_pop_view_content(Sp_View_Manager *view_mgr, bool pop_to_first)
{
	startfunc;
	MP_CHECK(view_mgr);
	MP_CHECK(view_mgr->navi);

	GList *last = g_list_last(view_mgr->view_history);
	MP_CHECK(last);
	Sp_View_Data *view_data = last->data;
	MP_CHECK(view_data);

	if (pop_to_first) {
		Elm_Object_Item *bottom_item = elm_naviframe_bottom_item_get(view_mgr->navi);
		if (bottom_item)
			elm_naviframe_item_pop_to(bottom_item);

		while(view_data && view_data->index > 0) {
			SAFE_FREE(view_data);
			view_mgr->view_history = g_list_delete_link(view_mgr->view_history, last);
			last = g_list_last(view_mgr->view_history);
			if (last)
				view_data = last->data;
		}
	} else {
		elm_naviframe_item_pop(view_mgr->navi);
		IF_FREE(view_data);
		view_mgr->view_history = g_list_delete_link(view_mgr->view_history, last);
	}

	if (g_list_length(view_mgr->view_history) == 0) {
		g_list_free(view_mgr->view_history);
		view_mgr->view_history = NULL;
	}
}
开发者ID:minjinsong,项目名称:tizen-music-player,代码行数:35,代码来源:sp-view-manager.c


示例11: IF_FREE

/** Release all the objects you're holding to.
 * @update	harishd 08/02/00
 * @return  void
 */
nsresult 
nsCParserNode::ReleaseAll() 
{
  if(mTokenAllocator) {
    IF_FREE(mToken,mTokenAllocator);
  }
  return NS_OK;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:12,代码来源:nsParserNode.cpp


示例12: fg_part_up

void
fg_part_up( void *data, Evas_Object *o,
						const char *emission, const char *source )
{
	Ewler_Widget *w = data;

	IF_FREE(w->source);
}
开发者ID:playya,项目名称:Enlightenment,代码行数:8,代码来源:widget.c


示例13: NS_ASSERTION

nsresult nsCParserStartNode::ReleaseAll() 
{
  NS_ASSERTION(0!=mTokenAllocator, "Error: no token allocator");
  CToken* theAttrToken;
  while ((theAttrToken = static_cast<CToken*>(mAttributes.Pop()))) {
    IF_FREE(theAttrToken, mTokenAllocator);
  }
  nsCParserNode::ReleaseAll();
  return NS_OK; 
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:10,代码来源:nsParserNode.cpp


示例14: ewl_dvi_file_set

/**
 * @param dvi: the dvi widget to change the displayed dvi
 * @param filename: the path to the new dvi to be displayed by @a dvi
 * @return Returns no value.
 * @brief Change the dvi file displayed by an dvi widget
 *
 * Set the dvi displayed by @a dvi to the one found at the path @a filename. If an
 * edje is used, a minimum size should be specified in the edje or the code.
 */
int
ewl_dvi_file_set(Ewl_Dvi *dvi, const char *filename)
{
        Ewl_Widget *w;
        Ewl_Embed *emb;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(dvi, FALSE);
        DCHECK_TYPE(dvi, EWL_DVI_TYPE);

        w = EWL_WIDGET(dvi);
        emb = ewl_embed_widget_find(w);

        if (!filename || (filename[0] == '\0'))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        if (dvi->filename != filename) {
                IF_FREE(dvi->filename);
        }

        if (dvi->dvi_page) {
                edvi_page_delete(dvi->dvi_page);
                dvi->dvi_page = NULL;
        }

        if (dvi->dvi_document) {
                edvi_document_delete(dvi->dvi_document);
                dvi->dvi_document = NULL;
        }

        dvi->filename = strdup(filename);

        /*
         * Load the new dvi if widget has been realized
         */

        dvi->dvi_document = edvi_document_new(dvi->filename, dvi->dvi_device, dvi->dvi_property);
        if (!dvi->dvi_document)
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        dvi->dvi_page = edvi_page_new(dvi->dvi_document);
        if (!dvi->dvi_page) {
                edvi_document_delete(dvi->dvi_document);
                dvi->dvi_document = NULL;
                DRETURN_INT(FALSE, DLEVEL_STABLE);
        }

        if (REALIZED(w)) {
                ewl_widget_obscure(w);
                ewl_widget_reveal(w);
        }

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
开发者ID:Limsik,项目名称:e17,代码行数:63,代码来源:ewl_dvi.c


示例15: sp_view_mgr_destroy

void
sp_view_mgr_destroy(Sp_View_Manager* view_mgr)
{
	startfunc;
	MP_CHECK(view_mgr);

	if (view_mgr->view_history) {
		GList *current = view_mgr->view_history;
		while(current) {
			IF_FREE(current->data);
			current = current->next;
		}

		g_list_free(view_mgr->view_history);
		view_mgr->view_history = NULL;
	}


	IF_FREE(view_mgr);
}
开发者ID:minjinsong,项目名称:tizen-music-player,代码行数:20,代码来源:sp-view-manager.c


示例16: NS_ENSURE_TRUE

/**
 * This method consumes an end tag and any "attributes" that may come after it.
 *
 * @param aChar The last character read from the scanner.
 * @param aToken The OUT parameter that holds our resulting token.
 * @param aScanner Our source of data
 * @return Error result
 */
nsresult
nsHTMLTokenizer::ConsumeEndTag(PRUnichar aChar,
                               CToken*& aToken,
                               nsScanner& aScanner)
{
  // Get the "/" (we've already seen it with a Peek)
  aScanner.GetChar(aChar);

  nsTokenAllocator* theAllocator = this->GetTokenAllocator();
  aToken = theAllocator->CreateTokenOfType(eToken_end, eHTMLTag_unknown);
  NS_ENSURE_TRUE(aToken, NS_ERROR_OUT_OF_MEMORY);

  // Remember this for later in case you have to unwind...
  int32_t theDequeSize = mTokenDeque.GetSize();
  nsresult result = NS_OK;

  // Tell the new token to finish consuming text...
  result = aToken->Consume(aChar, aScanner, mFlags);
  AddToken(aToken, result, &mTokenDeque, theAllocator);
  if (NS_FAILED(result)) {
    // Note that this early-return here is safe because we have not yet
    // added any of our tokens to the queue (AddToken only adds the token if
    // result is a success), so we don't need to fall through.
    return result;
  }

  result = aScanner.Peek(aChar);
  if (NS_FAILED(result)) {
    aToken->SetInError(true);

    // Note: We know here that the scanner is not incremental since if
    // this peek fails, then we've already masked over a kEOF coming from
    // the Consume() call above.
    return NS_OK;
  }

  if (kGreaterThan != aChar) {
    result = ConsumeAttributes(aChar, aToken, aScanner);
  } else {
    aScanner.GetChar(aChar);
  }

  // Do the same thing as we do in ConsumeStartTag. Basically, if we've run
  // out of room in this *section* of the document, pop all of the tokens
  // we've consumed this round and wait for more data.
  if (NS_FAILED(result)) {
    while (mTokenDeque.GetSize() > theDequeSize) {
      CToken* theToken = (CToken*)mTokenDeque.Pop();
      IF_FREE(theToken, mTokenAllocator);
    }
  }

  return result;
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:62,代码来源:nsHTMLTokenizer.cpp


示例17: ewl_icon_theme_cb_free

static void
ewl_icon_theme_cb_free(void *data)
{
        DENTER_FUNCTION(DLEVEL_STABLE);

        if (data == EWL_THEME_KEY_NOMATCH)
                DRETURN(DLEVEL_STABLE);

        IF_FREE(data);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
开发者ID:playya,项目名称:Enlightenment,代码行数:12,代码来源:ewl_icon_theme.c


示例18: elicit_free

void
elicit_free(Elicit *el)
{
  elicit_magnify_stop(el);

  if (el->color)
    color_unref(el->color);

  if (el->obj.main)
    evas_object_del(el->obj.main);

  if (el->obj.shot)
    evas_object_del(el->obj.shot);

  if (el->obj.swatch)
    evas_object_del(el->obj.swatch);

  if (el->ee)
    ecore_evas_free(el->ee);

  if (el->band)
    elicit_band_free(el->band);

  if (el->palette)
    palette_free(el->palette);

  IF_FREE(el->conf.theme);
  IF_FREE(el->path.theme);
  IF_FREE(el->path.datadir);
  IF_FREE(el->path.confdir);
  IF_FREE(el->path.palette);
  IF_FREE(el->path.conffile);

  free(el);
}
开发者ID:rephorm,项目名称:elicit,代码行数:35,代码来源:elicit.c


示例19: egxp_opcode_free

void egxp_opcode_free (Egxp_Opcode * op) {
#ifdef EGXP_DEBUG
  printf("TRACE: egxp_opcode_free\n");
#endif
  assert (op);
  
  /* free only the initial pointer */
  IF_FREE (op->id_string);

  // static string, so it's forbidden to destroy if (op->id_string) free (op->id_string);
  ecore_hash_destroy (op->string_id);
  FREE (op);
}
开发者ID:BackupTheBerlios,项目名称:eim-svn,代码行数:13,代码来源:egxp_opcode.c


示例20: exml_tag_set

/**
 * Set the current tag name
 * @param   xml The xml document to modify
 * @param   tag The new tag name
 * @return  @c TRUE if successful, @c FALSE if an error occurs.
 * @ingroup EXML_Modfiy_Element_Group
 */
int exml_tag_set(EXML *xml, char *tag)
{
	CHECK_PARAM_POINTER_RETURN("xml", xml, FALSE);
	CHECK_PARAM_POINTER_RETURN("tag", tag, FALSE);

	IF_FREE(xml->current->tag);

	xml->current->tag = strdup( tag );
	if (!xml->current->tag)
		return FALSE;

	return TRUE;
}
开发者ID:playya,项目名称:Enlightenment,代码行数:20,代码来源:exml.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ IF_NAME函数代码示例发布时间:2022-05-30
下一篇:
C++ IF_DEQUEUE函数代码示例发布时间: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