couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r905438 - in /couchdb/trunk/src/couchdb: couch_doc.erl couch_httpd.erl couch_httpd_auth.erl couch_httpd_db.erl couch_native_process.erl couch_query_servers.erl couch_rep_reader.erl
Date Mon, 01 Feb 2010 23:03:03 GMT
Author: jan
Date: Mon Feb  1 23:03:02 2010
New Revision: 905438

URL: http://svn.apache.org/viewvc?rev=905438&view=rev
Log:
fix unused variable warnings, remove unused code.

Modified:
    couchdb/trunk/src/couchdb/couch_doc.erl
    couchdb/trunk/src/couchdb/couch_httpd.erl
    couchdb/trunk/src/couchdb/couch_httpd_auth.erl
    couchdb/trunk/src/couchdb/couch_httpd_db.erl
    couchdb/trunk/src/couchdb/couch_native_process.erl
    couchdb/trunk/src/couchdb/couch_query_servers.erl
    couchdb/trunk/src/couchdb/couch_rep_reader.erl

Modified: couchdb/trunk/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_doc.erl?rev=905438&r1=905437&r2=905438&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_doc.erl (original)
+++ couchdb/trunk/src/couchdb/couch_doc.erl Mon Feb  1 23:03:02 2010
@@ -295,7 +295,7 @@
     Bin;
 att_to_iolist(#att{data=Iolist}) when is_list(Iolist) ->
     Iolist;
-att_to_iolist(#att{data={Fd,Sp}}=Att) ->
+att_to_iolist(#att{data={_Fd,_Sp}}=Att) ->
     lists:reverse(att_foldl(Att,
         fun(Bin,Acc) -> [Bin|Acc] end, []));
 att_to_iolist(#att{data=DataFun, att_len=Len}) when is_function(DataFun)->

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=905438&r1=905437&r2=905438&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Mon Feb  1 23:03:02 2010
@@ -278,7 +278,7 @@
         EncList
     end.
 
-serve_file(#httpd{mochi_req=MochiReq}=Req, RelativePath, DocumentRoot) ->
+serve_file(Req, RelativePath, DocumentRoot) ->
     serve_file(Req, RelativePath, DocumentRoot, []).
 
 serve_file(#httpd{mochi_req=MochiReq}=Req, RelativePath, DocumentRoot, ExtraHeaders) ->

Modified: couchdb/trunk/src/couchdb/couch_httpd_auth.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_auth.erl?rev=905438&r1=905437&r2=905438&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_auth.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_auth.erl Mon Feb  1 23:03:02 2010
@@ -118,7 +118,7 @@
                   {<<"salt">>, ?l2b(Salt)},
                   {<<"password_sha">>, ?l2b(HashedPwd)}]
         end;
-    Else ->
+    _Else ->
         get_user_props_from_db(UserName)
     end.
 
@@ -139,12 +139,12 @@
                             ?LOG_ERROR("Invalid user doc. Id: ~p",[DocId]),
                             nil
                     end;
-                Else ->
+                _Else ->
                     throw({unauthorized, <<"User document conflict must be resolved
before login.">>})
             end
     catch
-        throw:Throw ->
-            nil        
+        throw:_Throw ->
+            nil
     end.
 
 % this should handle creating the ddoc
@@ -163,7 +163,7 @@
     try couch_httpd_db:couch_doc_open(Db, DDocId, nil, []) of
         _Foo -> ok
     catch 
-        _:Error -> 
+        _:_Error -> 
             % create the design document
             {ok, AuthDesign} = auth_design_doc(DDocId),
             {ok, _Rev} = couch_db:update_doc(Db, AuthDesign, []),
@@ -248,9 +248,9 @@
     Cookie -> 
         [User, TimeStr | HashParts] = try
             AuthSession = couch_util:decodeBase64Url(Cookie),
-            [A, B | Cs] = string:tokens(?b2l(AuthSession), ":")
+            [_A, _B | _Cs] = string:tokens(?b2l(AuthSession), ":")
         catch
-            _:Error ->
+            _:_Error ->
                 Reason = <<"Malformed AuthSession cookie. Please clear your cookies.">>,
                 throw({bad_request, Reason})
         end,
@@ -416,11 +416,9 @@
 handle_session_req(Req) ->
     send_method_not_allowed(Req, "GET,HEAD,POST,DELETE").
 
-maybe_value(Key, undefined, Fun) -> [];
+maybe_value(_Key, undefined, _Fun) -> [];
 maybe_value(Key, Else, Fun) -> 
     [{Key, Fun(Else)}].
-maybe_value(Key, undefined) -> [];
-maybe_value(Key, Else) -> [{Key, Else}].
 
 auth_name(String) when is_list(String) ->
     [_,_,_,_,_,Name|_] = re:split(String, "[\\W_]", [{return, list}]),

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=905438&r1=905437&r2=905438&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Mon Feb  1 23:03:02 2010
@@ -237,7 +237,7 @@
         couch_util:get_nested_json_value({Props}, [<<"filters">>, FName]),
         fun(DocInfos) ->
             Docs = [Doc || {ok, Doc} <- [
-                {ok, Doc} = couch_db:open_doc(Db, DInfo, [deleted, conflicts])
+                {ok, _Doc} = couch_db:open_doc(Db, DInfo, [deleted, conflicts])
                 || DInfo <- DocInfos]],
             {ok, Passes} = couch_query_servers:filter_docs(Req, Db, DDoc, FName, Docs),
             [{[{rev, couch_doc:rev_to_str(Rev)}]}
@@ -1154,17 +1154,6 @@
             <<>>
     end.
 
-parse_doc_format(FormatStr) when is_binary(FormatStr) ->
-    parse_doc_format(?b2l(FormatStr));
-parse_doc_format(FormatStr) when is_list(FormatStr) ->
-    SplitFormat = lists:splitwith(fun($/) -> false; (_) -> true end, FormatStr),
-    case SplitFormat of
-        {DesignName, [$/ | ShowName]} -> {?l2b(DesignName), ?l2b(ShowName)};
-        _Else -> throw({bad_request, <<"Invalid doc format">>})
-    end;
-parse_doc_format(_BadFormatStr) ->
-    throw({bad_request, <<"Invalid doc format">>}).
-
 parse_doc_query(Req) ->
     lists:foldl(fun({Key,Value}, Args) ->
         case {Key, Value} of

Modified: couchdb/trunk/src/couchdb/couch_native_process.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_native_process.erl?rev=905438&r1=905437&r2=905438&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_native_process.erl (original)
+++ couchdb/trunk/src/couchdb/couch_native_process.erl Mon Feb  1 23:03:02 2010
@@ -40,7 +40,8 @@
 -module(couch_native_process).
 -behaviour(gen_server).
 
--export([start_link/0,init/1,terminate/2,handle_call/3,handle_cast/2]).
+-export([start_link/0,init/1,terminate/2,handle_call/3,handle_cast/2,code_change/3,
+         handle_info/2]).
 -export([set_timeout/2, prompt/2]).
 
 -define(STATE, native_proc_state).
@@ -76,16 +77,18 @@
             throw:{error, Why} ->
                 {State, [<<"error">>, Why, Why]}
         end,
-    
+
     case Resp of
         {error, Reason} ->
             Msg = io_lib:format("couch native server error: ~p", [Reason]),
             {reply, [<<"error">>, <<"native_query_server">>, list_to_binary(Msg)],
NewState};
         [<<"error">> | Rest] ->
-            Msg = io_lib:format("couch native server error: ~p", [Rest]),
+            % Msg = io_lib:format("couch native server error: ~p", [Rest]),
+            % TODO: markh? (jan)
             {reply, [<<"error">> | Rest], NewState};
         [<<"fatal">> | Rest] ->
-            Msg = io_lib:format("couch native server error: ~p", [Rest]),
+            % Msg = io_lib:format("couch native server error: ~p", [Rest]),
+            % TODO: markh? (jan)
             {stop, fatal, [<<"error">> | Rest], NewState};
         Resp ->
             {reply, Resp, NewState}
@@ -169,11 +172,11 @@
     BFun = lists:foldl(fun
         (Key, {Props}) when is_list(Props) ->
             proplists:get_value(Key, Props, nil);
-        (Key, Fun) when is_binary(Fun) ->
+        (_Key, Fun) when is_binary(Fun) ->
             Fun;
-        (Key, nil) ->
+        (_Key, nil) ->
             throw({error, not_found});
-        (Key, Fun) -> 
+        (_Key, _Fun) ->
             throw({error, malformed_ddoc})
         end, {DDoc}, FunPath),
     ddoc(State, makefun(State, BFun, {DDoc}), FunPath, Args).
@@ -238,7 +241,7 @@
     try dict:fetch(DDocId, DDocs) of
         {DDoc} -> {DDoc}
     catch
-        _:Else -> throw({error, ?l2b(io_lib:format("Native Query Server missing DDoc with
Id: ~s",[DDocId]))})
+        _:_Else -> throw({error, ?l2b(io_lib:format("Native Query Server missing DDoc
with Id: ~s",[DDocId]))})
     end.
 
 bindings(State, Sig) ->
@@ -300,7 +303,7 @@
         {'FoldRows', FoldRows}
     ],
     case DDoc of
-        {Props} ->
+        {_Props} ->
             Bindings ++ [{'DDoc', DDoc}];
         _Else -> Bindings
     end.

Modified: couchdb/trunk/src/couchdb/couch_query_servers.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_query_servers.erl?rev=905438&r1=905437&r2=905438&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_query_servers.erl (original)
+++ couchdb/trunk/src/couchdb/couch_query_servers.erl Mon Feb  1 23:03:02 2010
@@ -406,11 +406,6 @@
         throw(Error)
     end.
 
-ret_ddoc_process(Proc) ->
-    true = gen_server:call(couch_query_servers, {ret_proc, Proc}),
-    catch unlink(Proc#proc.pid),
-    ok.
-
 get_os_process(Lang) ->
     case gen_server:call(couch_query_servers, {get_proc, Lang}) of
     {ok, Proc, QueryConfig} ->

Modified: couchdb/trunk/src/couchdb/couch_rep_reader.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_reader.erl?rev=905438&r1=905437&r2=905438&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_reader.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_reader.erl Mon Feb  1 23:03:02 2010
@@ -51,7 +51,7 @@
 next(Pid) ->
     gen_server:call(Pid, next_docs, infinity).
 
-init([Parent, Source, MissingRevs_or_DocIds, PostProps]) ->
+init([Parent, Source, MissingRevs_or_DocIds, _PostProps]) ->
     process_flag(trap_exit, true),
     if is_record(Source, http_db) ->
         #url{host=Host, port=Port} = ibrowse_lib:parse_url(Source#http_db.url),



Mime
View raw message