--- parser3/src/classes/hash.C 2009/07/07 05:47:43 1.99 +++ parser3/src/classes/hash.C 2009/07/29 05:01:33 1.102 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_HASH_C="$Date: 2009/07/07 05:47:43 $"; +static const char * const IDENT_HASH_C="$Date: 2009/07/29 05:01:33 $"; #include "classes.h" #include "pa_vmethod_frame.h" @@ -34,10 +34,6 @@ public: // Methoded DECLARE_CLASS_VAR(hash, new MHash, 0); -// externs - -extern String cycle_data_name; - // methods #ifndef DOXYGEN @@ -232,9 +228,9 @@ static void _sub(Request& r, MethodParam } static void copy_all_dontoverwrite_to( - HashStringValue::key_type key, - HashStringValue::value_type value, - HashStringValue* dest) { + HashStringValue::key_type key, + HashStringValue::value_type value, + HashStringValue* dest) { dest->put_dont_replace(key, value); } static void _union(Request& r, MethodParams& params) { @@ -256,9 +252,9 @@ struct Copy_intersection_to_info { }; #endif static void copy_intersection_to( - HashStringValue::key_type key, - HashStringValue::value_type value, - Copy_intersection_to_info *info) { + HashStringValue::key_type key, + HashStringValue::value_type value, + Copy_intersection_to_info *info) { if(info->b->get(key)) info->dest->put_dont_replace(key, value); } @@ -276,9 +272,9 @@ static void _intersection(Request& r, Me } static bool intersects( - HashStringValue::key_type key, - HashStringValue::value_type /*value*/, - HashStringValue* b) { + HashStringValue::key_type key, + HashStringValue::value_type /*value*/, + HashStringValue* b) { return b->get(key)!=0; } @@ -376,10 +372,10 @@ static void _sql(Request& r, MethodParam } static void keys_collector( - HashStringValue::key_type key, - HashStringValue::value_type, - Table *table) { - Table::element_type row(new ArrayString); + HashStringValue::key_type key, + HashStringValue::value_type, + Table *table) { + Table::element_type row(new ArrayString(1)); *row+=new String(key, String::L_TAINTED); *table+=row; } @@ -390,7 +386,7 @@ static void _keys(Request& r, MethodPara else keys_column_name=new String("key"); - Table::columns_type columns(new ArrayString); + Table::columns_type columns(new ArrayString(1)); *columns+=keys_column_name; Table* table=new Table(columns); @@ -457,8 +453,7 @@ static bool one_foreach_cycle( } } static void _foreach(Request& r, MethodParams& params) { - Temp_hash_value - cycle_data_setter(r.classes_conf, cycle_data_name, /*any not null flag*/&r); + InCycle temp(r); const String& key_var_name=params.as_string(0, "key-var name must be string"); const String& value_var_name=params.as_string(1, "value-var name must be string");