Changeset 1448


Ignore:
Timestamp:
Dec 17, 2002, 2:16:30 PM (18 years ago)
Author:
landonf (Landon Fuller)
Message:

Avoid creating a new procedure for a simple regsub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/landonf-1_0/base/src/port/port.tcl

    r1447 r1448  
    160160    puts stderr "$argv0: $args"
    161161    exit
    162 }
    163 
    164 # Escape regex special characters
    165 proc regex_escape {string} {
    166     puts $string
    167     regsub -all "(\\(){1}|(\\)){1}|(\\{1}){1}|(\\+){1}|(\\{1}){1}|(\\{){1}|(\\}){1}|(\\^){1}|(\\$){1}|(\\.){1}|(\\\\){1}" $string "\\\\&" escaped
    168     return $escaped
    169162}
    170163
     
    278271        set target $action
    279272        if {[info exists portname]} {
    280             set res [dportsearch ^[regex_escape $portname]\$]
     273                # Escape regex special characters
     274                regsub -all "(\\(){1}|(\\)){1}|(\\{1}){1}|(\\+){1}|(\\{1}){1}|(\\{){1}|(\\}){1}|(\\^){1}|(\\$){1}|(\\.){1}|(\\\\){1}" $portname "\\\\&" search_string
     275            set res [dportsearch ^$search_string\$]
    281276            if {[catch {set res [dportsearch ^[regex_escape $portname]\$]} result]} {
    282277                puts "port search failed: $result"
Note: See TracChangeset for help on using the changeset viewer.