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); }
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); }
/** * 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); }
/** * 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); }
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); } }
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); }
/** * 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); }
/** * 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; }
/** * 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; }
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; } }
/** 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; }
void e_entry_free(E_Entry *entry) { entries = evas_list_remove(entries, entry); e_entry_unrealize(entry); IF_FREE(entry->buffer); FREE(entry); }
void fg_part_up( void *data, Evas_Object *o, const char *emission, const char *source ) { Ewler_Widget *w = data; IF_FREE(w->source); }
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; }
EAPI int efreet_desktop_save_as(Efreet_Desktop *desktop, const char *file) { /* If we save data from eet as new, we will be in trouble */ if (desktop->eet) return 0; IF_FREE(desktop->orig_path); desktop->orig_path = strdup(file); return efreet_desktop_save(desktop); }
/** * @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); }
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); }
/** * 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; }
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); }
EAPI void ecore_exe_tag_set(Ecore_Exe *exe, const char *tag) { if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) { ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_set"); return; } IF_FREE(exe->tag); if (tag) exe->tag = strdup(tag); }
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); }
void e_entry_set_text(E_Entry *entry, const char *text) { IF_FREE(entry->buffer); entry->buffer = strdup(text); evas_object_text_text_set(entry->text, entry->buffer); if (entry->cursor_pos > (int)strlen(entry->buffer)) entry->cursor_pos = strlen(entry->buffer); /* kjb - let's not do this */ //e_entry_configure(entry); if (entry->func_changed) entry->func_changed(entry, entry->data_changed); }
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); }
/** * 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; }
/** * Set the current tag value * @param xml The xml document to modify * @param value The new value name * @return @c TRUE if successful, @c FALSE if an error occurs. * @ingroup EXML_Modfiy_Element_Group */ int exml_value_set(EXML *xml, char *value) { CHECK_PARAM_POINTER_RETURN("xml", xml, FALSE); CHECK_PARAM_POINTER_RETURN("value", value, FALSE); IF_FREE(xml->current->value); xml->current->value = strdup( value ); if (!xml->current->value) return FALSE; return TRUE; }
EAPI int efreet_desktop_save_as(Efreet_Desktop *desktop, const char *file) { EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(file, 0); /* If we save data from eet as new, we will be in trouble */ if (desktop->eet) return 0; IF_FREE(desktop->orig_path); desktop->orig_path = strdup(file); return efreet_desktop_save(desktop); }
/** * Release all objects in the entry stack */ void nsEntryStack::ReleaseAll(nsNodeAllocator* aNodeAllocator) { NS_ASSERTION(aNodeAllocator,"no allocator? - potential leak!"); if(aNodeAllocator) { NS_ASSERTION(mCount >= 0,"count should not be negative"); while(mCount > 0) { nsCParserNode* node=this->Pop(); IF_FREE(node,aNodeAllocator); } } }
/** * @param ps: the ps widget to change the displayed ps * @param filename: the path to the new postscript file to be displayed by @a ps * @return 0 on failure, 1 otherwise. * @brief Change the postscript file displayed by a ps widget * * Set the postscript file displayed by @a ps to the one found at the path * @a filename. */ int ewl_ps_file_set(Ewl_Ps *ps, const char *filename) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(ps, FALSE); DCHECK_TYPE(ps, EWL_PS_TYPE); w = EWL_WIDGET(ps); if (ps->filename != filename) { IF_FREE(ps->filename); } if (!filename || (filename[0] == '\0')) DRETURN_INT(FALSE, DLEVEL_STABLE); if (ps->ps_page) { eps_page_delete(ps->ps_page); ps->ps_page = NULL; } if (ps->ps_document) { eps_document_delete(ps->ps_document); ps->ps_document = NULL; } ps->filename = strdup(filename); /* * Load the new Postscript document */ ps->ps_document = eps_document_new(filename); if (!ps->ps_document) DRETURN_INT(FALSE, DLEVEL_STABLE); ps->ps_page = eps_page_new(ps->ps_document); if (!ps->ps_page) { eps_document_delete(ps->ps_document); ps->ps_document = NULL; DRETURN_INT(FALSE, DLEVEL_STABLE); } if (REALIZED(w)) { ewl_widget_unrealize(w); ewl_widget_reveal(w); } DRETURN_INT(TRUE, DLEVEL_STABLE); }
/* static */ void nsHTMLTokenizer::AddToken(CToken*& aToken, nsresult aResult, nsDeque* aDeque, nsTokenAllocator* aTokenAllocator) { if (aToken && aDeque) { if (NS_SUCCEEDED(aResult)) { aDeque->Push(aToken); } else { IF_FREE(aToken, aTokenAllocator); } } }
/** * callback for project options dialog */ static EWL_CALLBACK_DEFN(options_cb) { int *response_id = ev_data; if( *response_id == EWL_RESPONSE_SAVE ) { IF_FREE(active_project->path); active_project->path = ewl_text_text_get(EWL_TEXT(active_project_options.path_entry)); IF_FREE(active_project->name); active_project->name = ewl_text_text_get(EWL_TEXT(active_project_options.name_entry)); IF_FREE(active_project->filename); active_project->filename = ewl_text_text_get(EWL_TEXT(active_project_options.filename_entry)); active_project->dirty = true; } ewl_widget_destroy(options_win); options_win = NULL; }