aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/re.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-12-28 14:34:51 +0100
committerErlang/OTP <[email protected]>2010-12-28 14:34:51 +0100
commit56dc83847776b400b7122a2e378a65f221096bed (patch)
treef6d5ff9b3f913e0aaaf78a50f0500bb4888f48e9 /lib/stdlib/src/re.erl
parent149a68f24671702ac0dfd3fcea9e35f18b8d9b53 (diff)
parent0fe99329f6d39a5dfddda689a90917982fa2ee0b (diff)
downloadotp-56dc83847776b400b7122a2e378a65f221096bed.tar.gz
otp-56dc83847776b400b7122a2e378a65f221096bed.tar.bz2
otp-56dc83847776b400b7122a2e378a65f221096bed.zip
Merge branch 'pan/r14b01-dialyzer-patch/OTP-9008' into maint-r14
* pan/r14b01-dialyzer-patch/OTP-9008: Correct type specs in io Remove dead code (and dialyzer errors) from filename and re Set types correctly for open_port({spawn_executable, ... Fix native code compiler infinite loop and update type info for 're'
Diffstat (limited to 'lib/stdlib/src/re.erl')
-rw-r--r--lib/stdlib/src/re.erl42
1 files changed, 19 insertions, 23 deletions
diff --git a/lib/stdlib/src/re.erl b/lib/stdlib/src/re.erl
index 296a6b3d23..9642de17b4 100644
--- a/lib/stdlib/src/re.erl
+++ b/lib/stdlib/src/re.erl
@@ -208,29 +208,25 @@ replace(Subject,RE,Replacement,Options) ->
process_repl_params(Options,iodata,false),
FlatSubject = to_binary(Subject, Unicode),
FlatReplacement = to_binary(Replacement, Unicode),
- case do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt) of
- {error,_Err} ->
- throw(badre);
- IoList ->
- case Convert of
- iodata ->
- IoList;
- binary ->
- case Unicode of
- false ->
- iolist_to_binary(IoList);
- true ->
- unicode:characters_to_binary(IoList,unicode)
- end;
- list ->
- case Unicode of
- false ->
- binary_to_list(iolist_to_binary(IoList));
- true ->
- unicode:characters_to_list(IoList,unicode)
- end
- end
- end
+ IoList = do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt),
+ case Convert of
+ iodata ->
+ IoList;
+ binary ->
+ case Unicode of
+ false ->
+ iolist_to_binary(IoList);
+ true ->
+ unicode:characters_to_binary(IoList,unicode)
+ end;
+ list ->
+ case Unicode of
+ false ->
+ binary_to_list(iolist_to_binary(IoList));
+ true ->
+ unicode:characters_to_list(IoList,unicode)
+ end
+ end
catch
throw:badopt ->
erlang:error(badarg,[Subject,RE,Replacement,Options]);