Diff for /parser3/src/main/pa_stylesheet_manager.C between versions 1.16.2.5 and 1.16.4.1

version 1.16.2.5, 2003/03/06 12:58:33 version 1.16.4.1, 2003/03/17 14:48:06
Line 1 Line 1
 /** @file  /** @file
         Parser: sql driver manager implementation.          Parser: sql driver manager implementation.
   
         Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com)
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
 */  */
 #include "pa_config_includes.h"  #include "pa_config_includes.h"
Line 20  static const char* IDENT_STYLESHEET_MANA Line 20  static const char* IDENT_STYLESHEET_MANA
   
 // globals  // globals
   
 Stylesheet_manager stylesheet_manager;  Stylesheet_manager *stylesheet_manager;
   
 // consts  // consts
   
Line 53  Stylesheet_manager::~Stylesheet_manager( Line 53  Stylesheet_manager::~Stylesheet_manager(
                 reinterpret_cast<void *>(time(0)+1/*=in future=expire all*/));                  reinterpret_cast<void *>(time(0)+1/*=in future=expire all*/));
 }  }
   
 Stylesheet_connectionPtr Stylesheet_manager::get_connection(StringPtr request_file_spec) {  Stylesheet_connection_ptr Stylesheet_manager::get_connection(const String& request_file_spec) {
         Pool& pool=request_file_spec.pool(); // request pool                                                                                                 Pool& pool=request_file_spec.pool(); // request pool                                                                                       
   
         // first trying to get cached stylesheet          // first trying to get cached stylesheet
Line 62  Stylesheet_connectionPtr Stylesheet_mana Line 62  Stylesheet_connectionPtr Stylesheet_mana
                 // then just construct it                  // then just construct it
   
                 // make global_file_spec C-string on global pool                  // make global_file_spec C-string on global pool
                 CharPtr global_file_spec_cstr=request_file_spec.cstr(this->pool(pool), 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_atomic(strlen(request_file_spec_cstr)+1);
                   strcpy(global_file_spec_cstr, request_file_spec_cstr);
                 // make global_file_spec string on global pool                  // make global_file_spec string on global pool
                 String& global_file_spec=*new(this->pool()) String(this->pool(), global_file_spec_cstr);                  String& global_file_spec=*new(this->pool()) String(this->pool(), global_file_spec_cstr);
   
Line 71  Stylesheet_connectionPtr Stylesheet_mana Line 73  Stylesheet_connectionPtr Stylesheet_mana
         // associate with services[request]  (deassociates at close)          // associate with services[request]  (deassociates at close)
         connection->set_services(&pool);           connection->set_services(&pool); 
         // return autoclosing object for it          // return autoclosing object for it
         return Stylesheet_connectionPtr(connection);          return Stylesheet_connection_ptr(connection);
 }  }
   
 void Stylesheet_manager::close_connection(StringPtr file_spec,   void Stylesheet_manager::close_connection(const String& file_spec, 
                                                                                   Stylesheet_connection& connection) {                                                                                    Stylesheet_connection& connection) {
         // deassociate from services[request]          // deassociate from services[request]
         connection.set_services(0);          connection.set_services(0);
Line 84  void Stylesheet_manager::close_connectio Line 86  void Stylesheet_manager::close_connectio
   
 // stylesheet cache  // stylesheet cache
 /// @todo get rid of memory spending Stack [zeros deep inside got accumulated]  /// @todo get rid of memory spending Stack [zeros deep inside got accumulated]
 Stylesheet_connection *Stylesheet_manager::get_connection_from_cache(StringPtr file_spec) {   Stylesheet_connection *Stylesheet_manager::get_connection_from_cache(const String& file_spec) { 
         SYNCHRONIZED;          SYNCHRONIZED;
   
         if(Stack *connections=static_cast<Stack *>(connection_cache.get(file_spec)))          if(Stack *connections=static_cast<Stack *>(connection_cache.get(file_spec)))
Line 97  Stylesheet_connection *Stylesheet_manage Line 99  Stylesheet_connection *Stylesheet_manage
         return 0;          return 0;
 }  }
   
 void Stylesheet_manager::put_connection_to_cache(StringPtr file_spec,   void Stylesheet_manager::put_connection_to_cache(const String& file_spec, 
                                                                                                  Stylesheet_connection& connection) {                                                                                                    Stylesheet_connection& connection) { 
         SYNCHRONIZED;          SYNCHRONIZED;
   
Line 132  static void add_connection_to_status_cac Line 134  static void add_connection_to_status_cac
                 row+=&connection.file_spec();                  row+=&connection.file_spec();
                 // time                  // time
                 time_t time_stamp=connection.get_time_used();                  time_t time_stamp=connection.get_time_used();
                 row+=new(pool) String(pool, pool.copy(ctime(&time_stamp)));                  const char *unsafe_time_cstr=ctime(&time_stamp);
                   int time_buf_size=strlen(unsafe_time_cstr);
                   char *safe_time_buf=(char *)pool.malloc_atomic(time_buf_size);
                   memcpy(safe_time_buf, unsafe_time_cstr, time_buf_size);
                   row+=new(pool) String(pool, safe_time_buf, time_buf_size);
   
                 table+=&row;                  table+=&row;
         }          }

Removed from v.1.16.2.5  
changed lines
  Added in v.1.16.4.1


E-mail: