/** * Initialize an xml document structure to some sane starting values. * @param xml The xml to initialize. * @return @c TRUE if successful, @c FALSE if an error occurs. * @ingroup EXML_Creation_Group */ int exml_init(EXML *xml) { CHECK_PARAM_POINTER_RETURN("xml", xml, FALSE); xml->buffers = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); ecore_hash_free_value_cb_set(xml->buffers, ECORE_FREE_CB(xmlBufferFree)); return TRUE; }
XmppIM * xmpp_im_new (Egxp * eg) { #ifdef XMPPIM_DEBUG printf("TRACE: xmpp_im_new\n"); #endif assert (eg); /* allocate the structure */ XmppIM * tmp = XMPPIM (malloc(sizeof (XmppIM))); /* define the destroy function */ tmp->extension.destroy = ECORE_FREE_CB(xmpp_im_free); /* allocate the roster */ tmp->roster = xmpp_im_roster_new (); /* return the structure */ return tmp; }
/** * Initialize an xml stylesheet structure to some sane starting values. * @param xsl The stylesheet to initialize. * @return @c TRUE if successful, @c FALSE if an error occurs. * @ingroup EXML_XSLT_Group */ int exml_xsl_init( EXML_XSL *xsl, char *filename ) { CHECK_PARAM_POINTER_RETURN("xsl", xsl, FALSE); xmlSubstituteEntitiesDefault(1); xmlLoadExtDtdDefaultValue = 1; xsl->buffers = ecore_list_new(); ecore_list_free_cb_set(xsl->buffers, ECORE_FREE_CB(xmlFree)); xsl->cur = xsltParseStylesheetFile((const xmlChar *) filename); if( !xsl->cur ) return FALSE; return TRUE; }
void eli_highscore_shutdown(void) { /* free the data */ ecore_hash_free_value_cb_set(hiscore_hash, ECORE_FREE_CB(_eli_highscore_list_free)); ecore_hash_destroy(hiscore_hash); eet_data_descriptor_free(edd_hiscore); eet_data_descriptor_free(edd_entry); free(eet_file_name); /* and the set the pointer to null */ hiscore_hash = NULL; edd_hiscore = NULL; edd_entry = NULL; eet_file_name = NULL; eet_shutdown(); }
/** * @param path: The path to the directory to read * @param show_dot: TRUE shows dot files, FALSE does not * @param show_dot_dot: TRUE shows .. for navigating upwards, FALSE does not * @param filter: The Ewl_Filelist_Filter to use * @return Returns an Ewl_Filelist_Directory structure * @brief Retrieves all files in a directory */ Ewl_Filelist_Directory * ewl_filelist_model_directory_new(const char *path, unsigned char show_dot, unsigned int show_dot_dot, Ewl_Filelist_Filter *filter) { Ewl_Filelist_Directory *dir; Ewl_Filelist_File *file; char filename[PATH_MAX], *file_temp; int nf = 0, nd = 0; Eina_List *all_files; Ecore_List *dirs, *files; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(path, NULL); files = ecore_list_new(); dirs = ecore_list_new(); ecore_list_free_cb_set(files, ECORE_FREE_CB(ewl_filelist_file_destroy)); ecore_list_free_cb_set(dirs, ECORE_FREE_CB(ewl_filelist_file_destroy)); all_files = ecore_file_ls(path); if (!all_files) DRETURN_PTR(NULL, DLEVEL_STABLE); /* Add in the ".." entry for now */ if ((show_dot_dot) && (strcmp(path, "/"))) all_files = eina_list_prepend(all_files, strdup(path)); EINA_LIST_FREE(all_files, file_temp) { /* allocate the memory for the file structure */ file = ewl_filelist_file_new(); if (!file) { ecore_list_destroy(files); ecore_list_destroy(dirs); DRETURN_PTR(NULL, DLEVEL_STABLE); } /* test for .. */ if (strcmp(file_temp, path)) { snprintf(filename, PATH_MAX, "%s/%s", path, file_temp); ewl_filelist_file_name_set(file, file_temp); } else { snprintf(filename, PATH_MAX, "%s", file_temp); ewl_filelist_file_name_set(file, ".."); } /* Generate the file information */ if (!ewl_filelist_file_path_set(file, filename)) { ewl_filelist_file_destroy(file); ecore_list_destroy(files); ecore_list_destroy(dirs); DRETURN_PTR(NULL, DLEVEL_STABLE); } if (ewl_filelist_file_is_dir(file)) { ecore_list_append(dirs, file); nd = nd + 1; } else { ecore_list_append(files, file); nf = nf + 1; } FREE(file_temp); }