--- parser3/src/classes/table.C 2001/08/07 13:54:13 1.100 +++ parser3/src/classes/table.C 2001/08/10 07:13:07 1.103 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) */ -static const char *RCSId="$Id: table.C,v 1.100 2001/08/07 13:54:13 parser Exp $"; +static const char *RCSId="$Id: table.C,v 1.103 2001/08/10 07:13:07 parser Exp $"; #include "pa_config_includes.h" @@ -437,27 +437,27 @@ static int sort_cmp_double(const void *a return 0; } static void _sort(Request& r, const String& method_name, MethodParams *params) { + Pool& pool=r.pool(); Value& key_maker=params->as_junction(0, "key-maker must be code"); - bool reverse=params->size()==2/*..[asc|desc]*/? + bool reverse=params->size()==2/*..[desc|asc|]*/? reverse=params->as_no_junction(1, "order must not be code").as_string()=="desc": - false; - - Table& table=static_cast(r.self)->table(); + true; - // anything to sort? - if(!table.size()) - return; + Table& old_table=static_cast(r.self)->table(); + Table& new_table=*new(pool) Table(pool, &method_name, old_table.columns()); - Table_seq_item *seq=(Table_seq_item *)malloc(sizeof(Table_seq_item)*table.size()); + Table_seq_item *seq=(Table_seq_item *)pool.malloc(sizeof(Table_seq_item)*old_table.size()); int i; // calculate key values bool key_values_are_strings=true; - for(i=0; i