diff options
author | Hans Bolinder <[email protected]> | 2019-03-21 08:32:41 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-03-21 08:32:41 +0100 |
commit | 185fae668ec4a5d58db2bd9803dc62d0391a33a2 (patch) | |
tree | 4a902376c6163c46047c0c3b2ff3b2e23e61b77f /lib/stdlib/src | |
parent | 1129d7b6c997df31a5b0855f55b1f1c37e3bd155 (diff) | |
parent | db88773fc257b2e6c8980ad0710c8f058a93286a (diff) | |
download | otp-185fae668ec4a5d58db2bd9803dc62d0391a33a2.tar.gz otp-185fae668ec4a5d58db2bd9803dc62d0391a33a2.tar.bz2 otp-185fae668ec4a5d58db2bd9803dc62d0391a33a2.zip |
Merge branch 'hasse/stdlib/optimize_string/OTP-15649'
* hasse/stdlib/optimize_string/OTP-15649:
stdlib: Optimize handling of Unicode in the string module
stdlib: Optimize handling of Unicode in the string module
stdlib: Fix a bug in string:lexemes()
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/string.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/stdlib/src/string.erl b/lib/stdlib/src/string.erl index 2939e78d9d..1f8bdc5432 100644 --- a/lib/stdlib/src/string.erl +++ b/lib/stdlib/src/string.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2018. All Rights Reserved. +%% Copyright Ericsson AB 1996-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -1247,18 +1247,20 @@ split_1(Bin, [_C|_]=Needle, Start, Where, Curr0, Acc) -> end end. -lexemes_m([CP|_]=Cs0, {GCs,CPs,_}=Seps, Ts) when is_integer(CP) -> +lexemes_m([CP|_]=Cs0, {GCs,CPs,_}=Seps0, Ts) when is_integer(CP) -> case lists:member(CP, CPs) of true -> [GC|Cs2] = unicode_util:gc(Cs0), case lists:member(GC, GCs) of true -> - lexemes_m(Cs2, Seps, Ts); + lexemes_m(Cs2, Seps0, Ts); false -> + Seps = search_compile(Seps0), {Lexeme,Rest} = lexeme_pick(Cs0, Seps, []), lexemes_m(Rest, Seps, [Lexeme|Ts]) end; false -> + Seps = search_compile(Seps0), {Lexeme,Rest} = lexeme_pick(Cs0, Seps, []), lexemes_m(Rest, Seps, [Lexeme|Ts]) end; |