Skip to content

Commit

Permalink
eliminate copy for Unicode.normalize of substring (#38381)
Browse files Browse the repository at this point in the history
eliminate copy for Unicode.normalize of substring
  • Loading branch information
stevengj authored Nov 11, 2020
1 parent 9c498bf commit af3cd59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/strings/unicode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const UTF8PROC_STRIPMARK = (1<<13)

utf8proc_error(result) = error(unsafe_string(ccall(:utf8proc_errmsg, Cstring, (Cssize_t,), result)))

function utf8proc_map(str::String, options::Integer)
function utf8proc_map(str::Union{String,SubString{String}}, options::Integer)
nwords = ccall(:utf8proc_decompose, Int, (Ptr{UInt8}, Int, Ptr{UInt8}, Int, Cint),
str, sizeof(str), C_NULL, 0, options)
nwords < 0 && utf8proc_error(nwords)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Unicode/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Unicode: normalize, isassigned

@testset "string normalization" begin
# normalize (Unicode normalization etc.):
@test normalize("\u006e\u0303", :NFC) == "\u00f1"
@test normalize("\u006e\u0303", :NFC) == "\u00f1" == normalize(SubString("ab\u006e\u0303cd",3,4), :NFC)
@test "\u006e\u0303" == normalize("\u00f1", :NFD)
@test normalize("\ufb00", :NFC) != "ff"
@test normalize("\ufb00", :NFKC) == "ff"
Expand Down

5 comments on commit af3cd59

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - successfully executed benchmarks. A full report can be found here. cc @christopher-dG

@maleadt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runtests(["Example"])

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - no issues were detected. A full report can be found here. cc @maleadt

Please sign in to comment.