--- parser3/src/main/pa_stylesheet_manager.C 2015/10/26 01:21:59 1.30 +++ parser3/src/main/pa_stylesheet_manager.C 2023/09/26 20:49:10 1.35 @@ -1,8 +1,8 @@ /** @file Parser: sql driver manager implementation. - Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #include "pa_config_includes.h" #ifdef XML @@ -15,7 +15,7 @@ #include "pa_vhash.h" #include "pa_vtable.h" -volatile const char * IDENT_PA_STYLESHEET_MANAGER_C="$Id: pa_stylesheet_manager.C,v 1.30 2015/10/26 01:21:59 moko Exp $" IDENT_PA_STYLESHEET_MANAGER_H; +volatile const char * IDENT_PA_STYLESHEET_MANAGER_C="$Id: pa_stylesheet_manager.C,v 1.35 2023/09/26 20:49:10 moko Exp $" IDENT_PA_STYLESHEET_MANAGER_H; // globals @@ -32,10 +32,7 @@ static void expire_connection(Stylesheet if(connection.connected() && connection.expired(older_dies)) connection.disconnect(); } -static void expire_connections( - Stylesheet_manager::connection_cache_type::key_type /*key*/, - Stylesheet_manager::connection_cache_type::value_type stack, - time_t older_dies) { +static void expire_connections(Stylesheet_manager::connection_cache_type::key_type /*key*/, Stylesheet_manager::connection_cache_type::value_type stack, time_t older_dies) { for(size_t i=0; itop_index(); i++) expire_connection(*stack->get(i), older_dies); } @@ -55,11 +52,9 @@ Stylesheet_manager::~Stylesheet_manager( connection_cache.for_each(expire_connections, time(0)+(time_t)10/*=in future=expire all*/); } -Stylesheet_connection_ptr Stylesheet_manager::get_connection(String::Body file_spec) { +Stylesheet_connection* Stylesheet_manager::get_connection(String::Body file_spec) { Stylesheet_connection* result=get_connection_from_cache(file_spec); - if(!result) - result=new Stylesheet_connection(file_spec); - return Stylesheet_connection_ptr(result); + return result ? result : new Stylesheet_connection(file_spec); } void Stylesheet_manager::close_connection(String::Body file_spec, Stylesheet_connection& connection) { @@ -81,8 +76,7 @@ Stylesheet_connection* Stylesheet_manage return 0; } -void Stylesheet_manager::put_connection_to_cache(String::Body file_spec, - Stylesheet_connection& connection) { +void Stylesheet_manager::put_connection_to_cache(String::Body file_spec, Stylesheet_connection& connection) { SYNCHRONIZED; connection_cache_type::value_type connections=connection_cache.get(file_spec); @@ -116,10 +110,7 @@ static void add_connection_to_status_cac *table+=&row; } } -static void add_connections_to_status_cache_table( - Stylesheet_manager::connection_cache_type::key_type /*key*/, - Stylesheet_manager::connection_cache_type::value_type stack, Table* table) -{ +static void add_connections_to_status_cache_table(Stylesheet_manager::connection_cache_type::key_type /*key*/, Stylesheet_manager::connection_cache_type::value_type stack, Table* table) { for(Array_iterator i(*stack); i.has_next(); ) add_connection_to_status_cache_table(*i.next(), table); }