Skip to content

Commit 6f9020c

Browse files
authored
Replace use of removed Base.nothing_sentinel (#28)
A better solution is to express Base's search functionality in terms of searching over chunks of contiguous memory, as I have proposed elsewhere. However, that will require a memory view API in Base.
1 parent 292a9cc commit 6f9020c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/search.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# optimized string routines copied from julia/base/strings/search.jl
22

3+
nothing_sentinel(x) = iszero(x) ? nothing : x
4+
35
function Base.findnext(pred::Base.Fix2{<:Union{typeof(isequal),typeof(==)},<:AbstractChar},
46
s::StringViewAndSub, i::Integer)
57
if i < 1 || i > sizeof(s)
@@ -8,7 +10,7 @@ function Base.findnext(pred::Base.Fix2{<:Union{typeof(isequal),typeof(==)},<:Abs
810
end
911
@inbounds isvalid(s, i) || Base.string_index_err(s, i)
1012
c = pred.x
11-
c '\x7f' && return Base.nothing_sentinel(Base._search(s, c % UInt8, i))
13+
c '\x7f' && return nothing_sentinel(Base._search(s, c % UInt8, i))
1214
while true
1315
i = Base._search(s, Base.first_utf8_byte(c), i)
1416
i == 0 && return nothing
@@ -42,7 +44,7 @@ end
4244
function Base.findprev(pred::Base.Fix2{<:Union{typeof(isequal),typeof(==)},<:AbstractChar},
4345
s::StringViewAndSub, i::Integer)
4446
c = pred.x
45-
c '\x7f' && return Base.nothing_sentinel(Base._rsearch(s, c % UInt8, i))
47+
c '\x7f' && return nothing_sentinel(Base._rsearch(s, c % UInt8, i))
4648
b = Base.first_utf8_byte(c)
4749
while true
4850
i = Base._rsearch(s, b, i)

0 commit comments

Comments
 (0)