File 0273-Replace-silly-variable-names-that-may-show-up-in-too.patch of Package erlang
From cb508eae4f41bc6c3033df21fa45e62d0be02134 Mon Sep 17 00:00:00 2001
From: Richard Carlsson <carlsson.richard@gmail.com>
Date: Mon, 2 Sep 2024 09:43:29 +0200
Subject: [PATCH] Replace silly variable names that may show up in tooling
Uses same variable names in the code as in the spec to avoid confusion.
---
lib/stdlib/src/binary.erl | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/stdlib/src/binary.erl b/lib/stdlib/src/binary.erl
index 4e66c00da0..503e99d9cd 100644
--- a/lib/stdlib/src/binary.erl
+++ b/lib/stdlib/src/binary.erl
@@ -750,7 +750,7 @@ _Examples:_
OnePos :: non_neg_integer(),
Result :: binary().
-replace(Haystack,Needles,Replacement,Options) ->
+replace(Subject,Pattern,Replacement,Options) ->
try
true = is_binary(Replacement) orelse is_function(Replacement, 1), % Make badarg instead of function clause
{Part,Global,Insert} = get_opts_replace(Options,{no,false,[]}),
@@ -762,9 +762,9 @@ replace(Haystack,Needles,Replacement,Options) ->
end,
MList = if
Global ->
- binary:matches(Haystack,Needles,Moptlist);
+ binary:matches(Subject,Pattern,Moptlist);
true ->
- case binary:match(Haystack,Needles,Moptlist) of
+ case binary:match(Subject,Pattern,Moptlist) of
nomatch -> [];
Match -> [Match]
end
@@ -781,12 +781,12 @@ replace(Haystack,Needles,Replacement,Options) ->
Splits = splitat(Replacement,0,lists:sort(Li)),
fun(M) -> lists:join(M, Splits) end
end,
- erlang:iolist_to_binary(do_replace(Haystack,MList,ReplList,0))
+ erlang:iolist_to_binary(do_replace(Subject,MList,ReplList,0))
catch
throw:badopt ->
- badarg_with_cause([Haystack,Needles,Replacement,Options], badopt);
+ badarg_with_cause([Subject,Pattern,Replacement,Options], badopt);
_:_ ->
- badarg_with_info([Haystack,Needles,Replacement,Options])
+ badarg_with_info([Subject,Pattern,Replacement,Options])
end.
--
2.43.0