Skip to content

Commit

Permalink
Replace silly variable names that may show up in tooling
Browse files Browse the repository at this point in the history
Uses same variable names in the code as in the spec to avoid confusion.
  • Loading branch information
richcarl committed Sep 2, 2024
1 parent e546206 commit cb508ea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/stdlib/src/binary.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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,[]}),
Expand All @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit cb508ea

Please sign in to comment.