--- parser3/src/main/pa_stylesheet_manager.C 2017/02/07 22:00:44 1.31 +++ parser3/src/main/pa_stylesheet_manager.C 2026/04/25 13:38:46 1.38 @@ -1,8 +1,8 @@ /** @file Parser: sql driver manager implementation. - Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://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.31 2017/02/07 22:00:44 moko Exp $" IDENT_PA_STYLESHEET_MANAGER_H; +volatile const char * IDENT_PA_STYLESHEET_MANAGER_C="$Id: pa_stylesheet_manager.C,v 1.38 2026/04/25 13:38:46 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,11 +110,8 @@ 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) -{ - for(Array_iterator i(*stack); i.has_next(); ) +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; ) add_connection_to_status_cache_table(*i.next(), table); }