From bceee0662a9f6aac6b0987517498bff2ade144df Mon Sep 17 00:00:00 2001
From: Stavros Aronis <aronisstav@gmail.com>
Date: Thu, 9 Feb 2012 14:55:38 +0100
Subject: Refactoring in plt

---
 lib/dialyzer/src/dialyzer_plt.erl | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/dialyzer/src/dialyzer_plt.erl b/lib/dialyzer/src/dialyzer_plt.erl
index 06eaadad9c..c973762df1 100644
--- a/lib/dialyzer/src/dialyzer_plt.erl
+++ b/lib/dialyzer/src/dialyzer_plt.erl
@@ -156,12 +156,7 @@ lookup_contract(#plt{contracts = Contracts},
 	 [{mfa(), {{Filename::string(), Line::pos_integer()}, #contract{}}}].
 
 lookup_callbacks(#plt{callbacks = Callbacks}, Mod) when is_atom(Mod) ->
-  FunModFilter =
-    fun({M, _F, _A}, _Val) -> M =:= Mod;
-       (       _Key, _Val) -> false
-    end,
-  ModCallbacks = dict:filter(FunModFilter, Callbacks),
-  dict:to_list(ModCallbacks).
+  table_filter_module(Callbacks, Mod).
 
 -type ret_args_types() :: {erl_types:erl_type(), [erl_types:erl_type()]}.
 
@@ -608,6 +603,14 @@ table_lookup_module(Plt, Mod) ->
     false -> {value, List}
   end.
 
+table_filter_module(Plt, Mod) ->
+  FunModFilter =
+    fun({M, _F, _A}, _Val) -> M =:= Mod;
+       (       _Key, _Val) -> false
+    end,
+  ModCallbacks = dict:filter(FunModFilter, Plt),
+  dict:to_list(ModCallbacks).
+
 table_all_modules(Plt) ->
   Fold =
     fun({M, _F, _A}, _Val, Acc) -> sets:add_element(M, Acc);
-- 
cgit v1.2.3