Index: openacs-4/packages/acs-tcl/tcl/deprecated-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/deprecated-procs.tcl,v diff -u -r1.27 -r1.28 --- openacs-4/packages/acs-tcl/tcl/deprecated-procs.tcl 14 Sep 2018 11:08:26 -0000 1.27 +++ openacs-4/packages/acs-tcl/tcl/deprecated-procs.tcl 14 Sep 2018 18:08:34 -0000 1.28 @@ -3174,27 +3174,6 @@ } } -# Since Tcl 8.5, lsearch has -index flag and can therefore achieve -# this natively. -ad_proc -deprecated -public util_search_list_of_lists { - list_of_lists query_string - {sublist_element_pos 0} -} { - Returns position of sublist that contains QUERY_STRING at SUBLIST_ELEMENT_POS. -} { - set sublist_index 0 - foreach sublist $list_of_lists { - set comparison_element [lindex $sublist $sublist_element_pos] - if { $query_string eq $comparison_element } { - return $sublist_index - } - incr sublist_index - } - # didn't find it - return -1 -} - - ######################################################################## # deprecated site-nodes-procs.tcl ######################################################################## Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.177 -r1.178 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 14 Sep 2018 17:59:51 -0000 1.177 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 14 Sep 2018 18:08:34 -0000 1.178 @@ -4005,6 +4005,26 @@ ns_log $level "${message}\n[uplevel ad_get_tcl_call_stack]${request}\n" } +ad_proc -public -deprecated util_search_list_of_lists {list_of_lists query_string {sublist_element_pos 0}} { + Returns position of sublist that contains QUERY_STRING at SUBLIST_ELEMENT_POS. + + The function can be replaced by "lsearch -index $pos $list_of_lists $query_string" + @see lsearch +} { + #set sublist_index 0 + #foreach sublist $list_of_lists { + # set comparison_element [lindex $sublist $sublist_element_pos] + # if { $query_string eq $comparison_element } { + # return $sublist_index + # } + # incr sublist_index + #} + # didn't find it + #return -1 + + return [lsearch -index $sublist_element_pos $list_of_lists $query_string] +} + # # Management of resource files, to be used in sitewide-admin procs to # decide between CDN installations an local installations.