Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0152-Make-sure-to-keep-tail-in-string-next_grap...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0152-Make-sure-to-keep-tail-in-string-next_grapheme-1.patch of Package erlang
From 2f0bf4fbd45acc9f6815b4acfb99d64fadca9fa8 Mon Sep 17 00:00:00 2001 From: Christian Rasmussen <christian.rasmussen@me.com> Date: Fri, 11 Mar 2022 23:44:19 +0100 Subject: [PATCH 1/2] Make sure to keep tail in string:next_grapheme/1 --- lib/stdlib/test/string_SUITE.erl | 14 ++++++++++---- lib/stdlib/uc_spec/gen_unicode_mod.escript | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/stdlib/test/string_SUITE.erl b/lib/stdlib/test/string_SUITE.erl index 4475d7c06e..2539bf8692 100644 --- a/lib/stdlib/test/string_SUITE.erl +++ b/lib/stdlib/test/string_SUITE.erl @@ -643,19 +643,25 @@ cd_gc(_) -> [] = string:next_codepoint(""), [] = string:next_codepoint(<<>>), [] = string:next_codepoint([<<>>]), + [$a|""] = string:next_codepoint("a"), + [$a|<<>>] = string:next_codepoint(<<"a">>), + [$a|[<<>>,$b]] = string:next_codepoint([<<"a">>,$b]), "abcd" = string:next_codepoint("abcd"), - [$e,778] = string:next_codepoint([$e,778]), + [$e|[778]] = string:next_codepoint([$e,778]), [$e|<<204,138>>] = string:next_codepoint(<<$e,778/utf8>>), - [778|_] = string:next_codepoint(tl(string:next_codepoint(<<$e,778/utf8>>))), + [778|<<>>] = string:next_codepoint(tl(string:next_codepoint(<<$e,778/utf8>>))), [0|<<128,1>>] = string:next_codepoint(<<0,128,1>>), {error,<<128,1>>} = string:next_codepoint(<<128,1>>), [] = string:next_grapheme(""), [] = string:next_grapheme(<<>>), [] = string:next_grapheme([<<>>]), + [$a|""] = string:next_grapheme("a"), + [$a|<<>>] = string:next_grapheme(<<"a">>), + [$a|[<<>>,$b]] = string:next_grapheme([<<"a">>,$b]), "abcd" = string:next_grapheme("abcd"), - [[$e,778]] = string:next_grapheme([$e,778]), - [[$e,778]] = string:next_grapheme(<<$e,778/utf8>>), + [[$e,778]|""] = string:next_grapheme([$e,778]), + [[$e,778]|<<>>] = string:next_grapheme(<<$e,778/utf8>>), [0|<<128,1>>] = string:next_grapheme(<<0,128,1>>), {error,<<128,1>>} = string:next_grapheme(<<128,1>>), diff --git a/lib/stdlib/uc_spec/gen_unicode_mod.escript b/lib/stdlib/uc_spec/gen_unicode_mod.escript index 8239b0d5a1..af27e47337 100644 --- a/lib/stdlib/uc_spec/gen_unicode_mod.escript +++ b/lib/stdlib/uc_spec/gen_unicode_mod.escript @@ -671,7 +671,7 @@ gen_gc(Fd, GBP) -> " false -> [CP0|T0]; % losing work done on T\n" " _TrueOrZWJ -> gc_extend2(cp(T), T, [CP,CP0])\n" " end;\n" - "gc_extend([], _, CP) -> [CP];\n" + "gc_extend([], T0, CP) -> [CP|T0];\n" "gc_extend({error,R}, _, CP) -> [CP|R].\n\n"), io:put_chars(Fd, "gc_extend2([CP|T], T0, Acc) ->\n" @@ -679,8 +679,8 @@ gen_gc(Fd, GBP) -> " false -> [lists:reverse(Acc)|T0]; % losing work done on T\n" " _TrueOrZWJ -> gc_extend2(cp(T), T, [CP|Acc])\n" " end;\n" - "gc_extend2([], _, Acc) ->\n" - " [lists:reverse(Acc)];\n" + "gc_extend2([], T0, Acc) ->\n" + " [lists:reverse(Acc)|T0];\n" "gc_extend2({error,R}, _, Acc) ->\n" " [lists:reverse(Acc)] ++ [R].\n\n" ), -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor