couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r788979 - in /couchdb/trunk/src/couchdb: couch_config_writer.erl couch_httpd_db.erl couch_key_tree.erl
Date Sat, 27 Jun 2009 14:32:36 GMT
Author: jchris
Date: Sat Jun 27 14:32:36 2009
New Revision: 788979

URL: http://svn.apache.org/viewvc?rev=788979&view=rev
Log:
removed some dead code found by Dialyzer, more to come

Modified:
    couchdb/trunk/src/couchdb/couch_config_writer.erl
    couchdb/trunk/src/couchdb/couch_httpd_db.erl
    couchdb/trunk/src/couchdb/couch_key_tree.erl

Modified: couchdb/trunk/src/couchdb/couch_config_writer.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_config_writer.erl?rev=788979&r1=788978&r2=788979&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_config_writer.erl (original)
+++ couchdb/trunk/src/couchdb/couch_config_writer.erl Sat Jun 27 14:32:36 2009
@@ -54,11 +54,8 @@
         _ ->
             NewFileContents2
     end,
-
-    % do the save, close the config file and get out
-    save_file(File, NewFileContents),
-    file:close(Stream),
-
+    
+    ok = file:write_file(File, list_to_binary(NewFileContents)),
     ok.
 
 %% @doc Iterates over the lines of an ini file and replaces or adds a new
@@ -164,9 +161,3 @@
         {match, _Start, _Length} ->
             Option ++ " = " ++ Value
     end.
-
-%% @spec save_file(File::filename(), Contents::string()) ->
-%%           ok | {error, Reason::string()}
-%% @doc Writes Contents to File
-save_file(File, Contents) ->
-    file:write_file(File, list_to_binary(Contents)).
\ No newline at end of file

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=788979&r1=788978&r2=788979&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Sat Jun 27 14:32:36 2009
@@ -637,19 +637,16 @@
         missing_rev -> nil;
         Rev -> Rev
     end,
-
     {TargetDocId, TargetRevs} = parse_copy_destination_header(Req),
-
-    % open revision Rev or Current  
+    % open old doc
     Doc = couch_doc_open(Db, SourceDocId, SourceRev, []),
     % save new doc
-    case couch_db:update_doc(Db, Doc#doc{id=TargetDocId, revs=TargetRevs}, []) of
-    {ok, NewTargetRev} ->
-        send_json(Req, 201, [{"Etag", "\"" ++ ?b2l(couch_doc:rev_to_str(NewTargetRev)) ++
"\""}],
-            update_doc_result_to_json(TargetDocId, {ok, NewTargetRev}));
-    Error ->
-        throw(Error)
-    end;
+    {ok, NewTargetRev} = couch_db:update_doc(Db, 
+        Doc#doc{id=TargetDocId, revs=TargetRevs}, []), 
+    % respond
+    send_json(Req, 201, 
+        [{"Etag", "\"" ++ ?b2l(couch_doc:rev_to_str(NewTargetRev)) ++ "\""}],
+        update_doc_result_to_json(TargetDocId, {ok, NewTargetRev}));
 
 db_doc_req(Req, _Db, _DocId) ->
     send_method_not_allowed(Req, "DELETE,GET,HEAD,POST,PUT,COPY").

Modified: couchdb/trunk/src/couchdb/couch_key_tree.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_key_tree.erl?rev=788979&r1=788978&r2=788979&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_key_tree.erl (original)
+++ couchdb/trunk/src/couchdb/couch_key_tree.erl Sat Jun 27 14:32:36 2009
@@ -29,12 +29,8 @@
     {Merged, HasConflicts} = 
     lists:foldl(
         fun(InsertTree, {AccTrees, AccConflicts}) ->
-            case merge_one(AccTrees, InsertTree, [], false) of
-            {ok, Merged, Conflicts} ->
-                {Merged, Conflicts or AccConflicts};
-            no ->
-                {[InsertTree | AccTrees], true} 
-            end
+            {ok, Merged, Conflicts} = merge_one(AccTrees, InsertTree, [], false),
+            {Merged, Conflicts or AccConflicts}
         end,
         {A, false}, B),
     if HasConflicts or 



Mime
View raw message