Esempio n. 1
0
inline void run_cleanup()
{
    // only call this once, on exit
    // to make sure valgrind output is clean
    // http://xmlsoft.org/xmlmem.html
    xmlCleanupCharEncodingHandlers();
    xmlCleanupEncodingAliases();
    xmlCleanupGlobals();
    xmlCleanupParser();
    xmlCleanupThreads();
    xmlCleanupInputCallbacks();
    xmlCleanupOutputCallbacks();
    xmlCleanupMemory();

#if defined(HAVE_CAIRO)
    // http://cairographics.org/manual/cairo-Error-handling.html#cairo-debug-reset-static-data
    cairo_debug_reset_static_data();
#endif

    // http://icu-project.org/apiref/icu4c/uclean_8h.html#a93f27d0ddc7c196a1da864763f2d8920
    u_cleanup();

#ifdef MAPNIK_USE_PROJ4
    // http://trac.osgeo.org/proj/ticket/149
 #if PJ_VERSION >= 480
    pj_clear_initcache();
 #endif
    // https://trac.osgeo.org/proj/wiki/ProjAPI#EnvironmentFunctions
    pj_deallocate_grids();
#endif    
}
/**
 * ExtractBoardList
 * コンストラクタ
 */
ExtractBoardList::ExtractBoardList(const char* file) {

     // HTML読み込み用構造体
     htmlDocPtr m_doc;
     // SQLiteAccessorのインスタンスを準備する
     SQLiteAccessor* accessor = new SQLiteAccessor();
     boardInfoArray = new wxArrayString();

     // ファイル名とエンコードの設定
     const char* enc = "utf-8";

     // HTMLの読み込み
     m_doc = htmlReadFile(file, enc, HTML_PARSE_RECOVER );

     if (NULL == m_doc) {
	  // NULLが返された場合その時点で終了する
	  xmlCleanupParser();
	  xmlCleanupCharEncodingHandlers();
	  delete accessor;
	  delete boardInfoArray;
	  return;
     }

     // htmlNodePtrに変換する
     htmlNodePtr root = xmlDocGetRootElement(m_doc);

     if (NULL == root) {
	  // NULLが返された場合その時点で終了する
	  xmlCleanupParser();
	  xmlCleanupCharEncodingHandlers();
	  delete accessor;
	  delete boardInfoArray;
	  return;
     } else {
	  // 正常処理
	  FindBoardInfo(root);
	  xmlCleanupParser();
	  xmlCleanupCharEncodingHandlers();
     }

     accessor->SetBoardInfoCommit(boardInfoArray);
     delete accessor;
     delete boardInfoArray;
}
Esempio n. 3
0
PLIST_API void plist_cleanup(void)
{
    /* free memory from parser initialization */
    xmlCleanupCharEncodingHandlers();
    xmlDictCleanup();
    xmlResetLastError();
    xmlCleanupGlobals();
    xmlCleanupThreads();
    xmlCleanupMemory();
}
Esempio n. 4
0
int xmlrpcsrv_cleanup() {

	xmlrpccmd_cleanup();

	if (xmlrpcsrv_registry) {
		xmlrpc_registry_free(xmlrpcsrv_registry);
		xmlrpcsrv_registry = NULL;
	}

	// Cleanup libxml2 stuff
	xmlCleanupCharEncodingHandlers();
	xmlCleanupParser();

	return POM_OK;
}
//---------------------------------------------------------------------------
int Policy::import_schema(const std::string& filename, const std::string& save_name)
{
    Schema s(no_https);
    xmlSetGenericErrorFunc(&s, &s.manage_generic_error);

    xmlDocPtr doc = xmlParseFile(filename.c_str());
    if (!doc)
    {
        // maybe put the errors from s.errors
        error = "The schema cannot be parsed";
        xmlSetGenericErrorFunc(NULL, NULL);
        return -1;
    }

    int ret = import_schema_from_doc(doc, save_name);
    xmlFreeDoc(doc);
    xmlCleanupCharEncodingHandlers();
    xmlSetGenericErrorFunc(NULL, NULL);
    return ret;
}
Esempio n. 6
0
/**
	@brief Destroy a transport_session and close its socket, without disconnecting from Jabber.
	@param session Pointer to the transport_session to be destroyed.
	@return 1 if successful, or 0 if not.

	This function may be called from a child process in order to free resources associated
	with the parent's transport_session, but without sending a disconnect to Jabber (since
	that would disconnect the parent).

	The only error condition is a NULL pointer argument.
*/
int session_discard( transport_session* session ) {
	if( ! session )
		return 0;

	if(session->sock_mgr)
		socket_manager_free(session->sock_mgr);

	if( session->state_machine ) free( session->state_machine );
	if( session->parser_ctxt) {
		xmlFreeDoc( session->parser_ctxt->myDoc );
		xmlFreeParserCtxt(session->parser_ctxt);
	}

	xmlCleanupCharEncodingHandlers();
	xmlDictCleanup();
	xmlCleanupParser();

	buffer_free(session->body_buffer);
	buffer_free(session->subject_buffer);
	buffer_free(session->thread_buffer);
	buffer_free(session->from_buffer);
	buffer_free(session->recipient_buffer);
	buffer_free(session->status_buffer);
	buffer_free(session->message_error_type);
	buffer_free(session->router_to_buffer);
	buffer_free(session->router_from_buffer);
	buffer_free(session->osrf_xid_buffer);
	buffer_free(session->router_class_buffer);
	buffer_free(session->router_command_buffer);
	buffer_free(session->session_id);

	free(session->server);
	free(session->unix_path);

	free( session );
	return 1;
}
Esempio n. 7
0
jsonObject* jsonXMLToJSONObject(const char* xml) {

    osrfXMLGatewayParser parser;

    /* don't define freeItem, since objects will be cleaned by freeing the parent */
    parser.objStack = osrfNewList(); 
    /* don't define freeItem, since the list eill end up empty if there are no errors*/
    parser.keyStack = osrfNewList(); 
    parser.obj = NULL;
    parser.inString = 0;
    parser.inNumber = 0;

    xmlParserCtxtPtr ctxt = xmlCreatePushParserCtxt(SAXHandler, &parser, "", 0, NULL);
    xmlParseChunk(ctxt, xml, strlen(xml), 1);

    osrfListFree(parser.objStack);
    osrfListFree(parser.keyStack);
    xmlFreeParserCtxt(ctxt);
    xmlCleanupCharEncodingHandlers();
    xmlDictCleanup();
    xmlCleanupParser();

    return parser.obj;
}