--- parser3/src/classes/date.C 2024/09/13 04:01:22 1.116 +++ parser3/src/classes/date.C 2024/12/23 16:59:17 1.121 @@ -1,7 +1,7 @@ /** @file Parser: @b date parser class. - Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) Authors: Konstantin Morshnev , Alexandr Petrosian */ @@ -14,7 +14,7 @@ #include "pa_vtable.h" #include "pa_vbool.h" -volatile const char * IDENT_DATE_C="$Id: date.C,v 1.116 2024/09/13 04:01:22 moko Exp $" IDENT_PA_VDATE_H; +volatile const char * IDENT_DATE_C="$Id: date.C,v 1.121 2024/12/23 16:59:17 moko Exp $" IDENT_PA_VDATE_H; // class @@ -43,8 +43,12 @@ public: } }; - -Table date_calendar_table_template(new Date_calendar_table_template_columns); +static Table &date_calendar_table_template(){ + static Table *singleton=NULL; + if(!singleton) + singleton=new Table(new Date_calendar_table_template_columns); + return *singleton; +} // methods @@ -193,7 +197,8 @@ tm cstr_to_time_t(char *cstr, const char char *cur=cstr; const char *year, *month, *mday; - const char *hour, *min, *sec, *msec PA_ATTR_UNUSED; + const char *hour, *min, *sec; + PA_UNUSED const char *msec; year=skip_number(&cur, "-:", &delim); if(delim != ':' || delim == ':' && strlen(year) >=4 ){ @@ -394,7 +399,7 @@ static void _roll(Request& r, MethodPara static Table& fill_month_days(Request& r, MethodParams& params, bool rus){ Table::Action_options table_options; - Table& result=*new Table(date_calendar_table_template, table_options); + Table& result=*new Table(date_calendar_table_template(), table_options); tm tmIn; memset(&tmIn, 0, sizeof(tmIn));