Skip to content

Commit

Permalink
Replace dict() type depending on Erlang release.
Browse files Browse the repository at this point in the history
Issue #15
  • Loading branch information
mworrell committed Jun 2, 2014
1 parent 205edc4 commit a9bba6f
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/webmachine_logger.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
response_length,
end_time :: tuple(),
finish_time :: tuple(),
metadata :: dict()}).
metadata :: wm_dict()}).

11 changes: 9 additions & 2 deletions include/wm_reqdata.hrl
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@

-ifdef(namespaced_dicts).
-type wm_dict() :: dict:dict().
-else.
-type wm_dict() :: dict().
-endif.

-record(wm_reqdata, {
% Reqstate
socket=undefined,
metadata=dict:new(),
metadata=dict:new() :: wm_dict(),
range=undefined,
peer=undefined :: inet:ip_address(),
bodyfetch=undefined,
Expand All @@ -14,7 +21,7 @@
disp_path,
path :: string(),
raw_path :: string(),
path_info :: dict(),
path_info :: wm_dict(),
path_tokens :: [string()],
app_root :: string(),
response_code :: pos_integer(),
Expand Down
5 changes: 4 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
%%-*- mode: erlang -*-
{erl_opts, [warnings_as_errors]}.
{erl_opts, [
warnings_as_errors,
{platform_define, "^[0-9]+", namespaced_dicts}
]}.
{cover_enabled, true}.
{edoc_opts, [{preprocess, true}]}.

Expand Down
2 changes: 1 addition & 1 deletion src/webmachine_decision_core.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
-author('Bryan Fink <[email protected]>').
-export([handle_request/2]).
-export([do_log/1]).
-include("webmachine_logger.hrl").
-include("wm_reqdata.hrl").
-include("webmachine_logger.hrl").

handle_request(Resource, ReqData) ->
try
Expand Down
5 changes: 4 additions & 1 deletion src/webmachine_logger.erl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-export([log_access/1, refresh/0, get_metadata/2]).
-include("webmachine_logger.hrl").

-include_lib("wm_reqdata.hrl").
-include_lib("webmachine_logger.hrl").

-record(state, {hourstamp, filename, handle}).

alog_path(BaseDir) ->
Expand Down
2 changes: 1 addition & 1 deletion src/webmachine_mochiweb.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
-author('Andy Gross <[email protected]>').
-export([start/1, start/2, stop/0, stop/1, loop/2]).

-include("webmachine_logger.hrl").
-include_lib("wm_reqdata.hrl").
-include_lib("webmachine_logger.hrl").

start(Options) ->
{PName, Options1} = case get_option(name, Options) of
Expand Down
3 changes: 3 additions & 0 deletions src/webmachine_perf_logger.erl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-export([log/1, refresh/0]).

-include_lib("wm_reqdata.hrl").
-include("webmachine_logger.hrl").

-record(state, {hourstamp, filename, handle}).

alog_path(BaseDir) ->
Expand Down
4 changes: 2 additions & 2 deletions src/webmachine_request.erl
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
use_sendfile/0
]).

-include("webmachine_logger.hrl").
-include("wm_reqdata.hrl").
-include_lib("wm_reqdata.hrl").
-include_lib("webmachine_logger.hrl").

-define(IDLE_TIMEOUT, infinity).
-define(FILE_CHUNK_LENGTH, 65536).
Expand Down
1 change: 1 addition & 0 deletions src/webmachine_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
%% supervisor callbacks
-export([init/1]).

-include_lib("wm_reqdata.hrl").
-include_lib("webmachine_logger.hrl").

%% @spec start_link() -> ServerRet
Expand Down
1 change: 0 additions & 1 deletion src/webzmachine.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
-export([start/0, stop/0]).
-export_type([reqdata/0, context/0, reply/0]).

-include("webmachine_logger.hrl").
-include_lib("include/wm_reqdata.hrl").

-opaque reqdata() :: #wm_reqdata{}.
Expand Down

0 comments on commit a9bba6f

Please sign in to comment.