本文整理汇总了C++中IF_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ IF_FREE函数的具体用法?C++ IF_FREE怎么用?C++ IF_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IF_FREE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}