--- parser3/src/main/pa_stylesheet_manager.C 2002/01/14 17:48:57 1.9 +++ parser3/src/main/pa_stylesheet_manager.C 2003/02/17 12:13:44 1.16.2.2 @@ -1,14 +1,14 @@ /** @file Parser: sql driver manager implementation. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://paf.design.ru) - - $Id: pa_stylesheet_manager.C,v 1.9 2002/01/14 17:48:57 paf Exp $ + Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) */ #include "pa_config_includes.h" #ifdef XML +static const char* IDENT_STYLESHEET_MANAGER_C="$Date: 2003/02/17 12:13:44 $"; + #include "pa_stylesheet_manager.h" #include "pa_stylesheet_connection.h" #include "pa_exception.h" @@ -53,27 +53,27 @@ Stylesheet_manager::~Stylesheet_manager( reinterpret_cast(time(0)+1/*=in future=expire all*/)); } -Stylesheet_connection& Stylesheet_manager::get_connection(const String& request_file_spec) { +Stylesheet_connection_ptr Stylesheet_manager::get_connection(const String& request_file_spec) { Pool& pool=request_file_spec.pool(); // request pool // first trying to get cached stylesheet - Stylesheet_connection *result=get_connection_from_cache(request_file_spec); - if(!result) { + Stylesheet_connection *connection=get_connection_from_cache(request_file_spec); + if(!connection) { // then just construct it // make global_file_spec C-string on global pool - const char *request_file_spec_cstr=request_file_spec.cstr(String::UL_FILE_SPEC); + const char* request_file_spec_cstr=request_file_spec.cstr(String::UL_FILE_SPEC); char *global_file_spec_cstr=(char *)malloc(strlen(request_file_spec_cstr)+1); strcpy(global_file_spec_cstr, request_file_spec_cstr); // make global_file_spec string on global pool String& global_file_spec=*new(this->pool()) String(this->pool(), global_file_spec_cstr); - result=new(this->pool()) Stylesheet_connection(this->pool(), global_file_spec); + connection=new(this->pool()) Stylesheet_connection(this->pool(), global_file_spec); } // associate with services[request] (deassociates at close) - result->set_services(&pool); - // return it - return *result; + connection->set_services(&pool); + // return autoclosing object for it + return Stylesheet_connection_ptr(connection); } void Stylesheet_manager::close_connection(const String& file_spec, @@ -134,11 +134,7 @@ static void add_connection_to_status_cac row+=&connection.file_spec(); // time time_t time_stamp=connection.get_time_used(); - const char *unsafe_time_cstr=ctime(&time_stamp); - int time_buf_size=strlen(unsafe_time_cstr); - char *safe_time_buf=(char *)pool.malloc(time_buf_size); - memcpy(safe_time_buf, unsafe_time_cstr, time_buf_size); - row+=new(pool) String(pool, safe_time_buf, time_buf_size); + row+=new(pool) String(pool, pool.copy(ctime(&time_stamp))); table+=&row; }