summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2011-02-15 15:56:04 +0000
committerEmile Joubert <emile@rabbitmq.com>2011-02-15 15:56:04 +0000
commit944de8b5e3aec103afc672666bbf6044e8379016 (patch)
tree6da5e0408c15ae373dcc71285decc926d22e43cb
parent17ebfb85ebc28c01dfc29e7089dbbf6d1688bc6c (diff)
downloadrabbitmq-server-944de8b5e3aec103afc672666bbf6044e8379016.tar.gz
Swapped helper function arguments
-rw-r--r--src/rabbit_msg_store.erl22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index 00c2ab18..a9d1e210 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -1975,7 +1975,7 @@ force_recovery(BaseDir, Store) ->
File <- list_sorted_file_names(Dir, ?FILE_EXTENSION_TMP)],
ok.
-for_each_file(Files, Fun) ->
+for_each_file(Fun, Files) ->
[Fun(File) || File <- Files].
transform_dir(BaseDir, Store, TransformFun) ->
@@ -1985,26 +1985,22 @@ transform_dir(BaseDir, Store, TransformFun) ->
true -> throw({error, transform_failed_previously});
false ->
OldFileList = list_sorted_file_names(Dir, ?FILE_EXTENSION),
- for_each_file(OldFileList,
- fun (File) ->
+ for_each_file(fun (File) ->
transform_msg_file(filename:join(Dir, File),
filename:join(TmpDir, File),
TransformFun)
- end),
- for_each_file(OldFileList,
- fun (File) ->
+ end, OldFileList),
+ for_each_file(fun (File) ->
file:delete(filename:join(Dir, File))
- end),
+ end, OldFileList),
NewFileList = list_sorted_file_names(TmpDir, ?FILE_EXTENSION),
- for_each_file(NewFileList,
- fun (File) ->
+ for_each_file(fun (File) ->
file:copy(filename:join(TmpDir, File),
filename:join(Dir, File))
- end),
- for_each_file(NewFileList,
- fun (File) ->
+ end, NewFileList),
+ for_each_file(fun (File) ->
file:delete(filename:join(TmpDir, File))
- end),
+ end, NewFileList),
ok = file:del_dir(TmpDir)
end.