Skip to content

Commit

Permalink
percent_encode: avoid repeated string copies
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Jul 26, 2023
1 parent 8f87400 commit 96d5581
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/port1.0/fetch_common.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ namespace eval portfetch::mirror_sites {
# percent-encode all characters in str that are not unreserved in URIs
proc portfetch::percent_encode {str} {
set outstr ""
while {$str ne ""} {
set char [string index $str 0]
set str [string range $str 1 end]
set len [string length $str]
for {set i 0} {$i < $len} {incr i} {
set char [string index $str $i]
switch -- $char {
{-} -
{.} -
Expand Down

0 comments on commit 96d5581

Please sign in to comment.