@@ -87,7 +87,8 @@ codeunit(s::String) = UInt8
8787
8888@inline function codeunit (s:: String , i:: Integer )
8989 @boundscheck checkbounds (s, i)
90- GC. @preserve s unsafe_load (pointer (s, i))
90+ b = GC. @preserve s unsafe_load (pointer (s, i))
91+ return b
9192end
9293
9394# # comparison ##
@@ -112,7 +113,7 @@ typemin(::String) = typemin(String)
112113
113114# # thisind, nextind ##
114115
115- Base . @propagate_inbounds thisind (s:: String , i:: Int ) = _thisind_str (s, i)
116+ @propagate_inbounds thisind (s:: String , i:: Int ) = _thisind_str (s, i)
116117
117118# s should be String or SubString{String}
118119@inline function _thisind_str (s, i:: Int )
@@ -133,7 +134,7 @@ Base.@propagate_inbounds thisind(s::String, i::Int) = _thisind_str(s, i)
133134 return i
134135end
135136
136- Base . @propagate_inbounds nextind (s:: String , i:: Int ) = _nextind_str (s, i)
137+ @propagate_inbounds nextind (s:: String , i:: Int ) = _nextind_str (s, i)
137138
138139# s should be String or SubString{String}
139140@inline function _nextind_str (s, i:: Int )
@@ -251,7 +252,7 @@ getindex(s::String, r::UnitRange{<:Integer}) = s[Int(first(r)):Int(last(r))]
251252 j = nextind (s, j) - 1
252253 n = j - i + 1
253254 ss = _string_n (n)
254- unsafe_copyto! (pointer (ss), pointer (s, i), n)
255+ GC . @preserve s ss unsafe_copyto! (pointer (ss), pointer (s, i), n)
255256 return ss
256257end
257258
@@ -323,7 +324,7 @@ function repeat(c::Char, r::Integer)
323324 n = 4 - (leading_zeros (u | 0xff ) >> 3 )
324325 s = _string_n (n* r)
325326 p = pointer (s)
326- if n == 1
327+ GC . @preserve s if n == 1
327328 ccall (:memset , Ptr{Cvoid}, (Ptr{UInt8}, Cint, Csize_t), p, u % UInt8, r)
328329 elseif n == 2
329330 p16 = reinterpret (Ptr{UInt16}, p)
@@ -340,7 +341,7 @@ function repeat(c::Char, r::Integer)
340341 unsafe_store! (p, b3, 3 i + 3 )
341342 end
342343 elseif n == 4
343- p32 = reinterpret (Ptr{UInt32}, pointer (s) )
344+ p32 = reinterpret (Ptr{UInt32}, p )
344345 for i = 1 : r
345346 unsafe_store! (p32, u, i)
346347 end
@@ -349,11 +350,11 @@ function repeat(c::Char, r::Integer)
349350end
350351
351352function filter (f, s:: String )
352- out = Base . StringVector (sizeof (s))
353+ out = StringVector (sizeof (s))
353354 offset = 1
354355 for c in s
355356 if f (c)
356- offset += Base . __unsafe_string! (out, c, offset)
357+ offset += __unsafe_string! (out, c, offset)
357358 end
358359 end
359360 resize! (out, offset- 1 )
0 commit comments