couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r963042 - /couchdb/trunk/src/couchdb/couch_util.erl
Date Sun, 11 Jul 2010 10:31:39 GMT
Author: fdmanana
Date: Sun Jul 11 10:31:38 2010
New Revision: 963042

URL: http://svn.apache.org/viewvc?rev=963042&view=rev
Log:
Removing unnecessary code.

Modified:
    couchdb/trunk/src/couchdb/couch_util.erl

Modified: couchdb/trunk/src/couchdb/couch_util.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_util.erl?rev=963042&r1=963041&r2=963042&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_util.erl (original)
+++ couchdb/trunk/src/couchdb/couch_util.erl Sun Jul 11 10:31:38 2010
@@ -144,18 +144,11 @@ get_nested_json_value(Value, []) ->
 get_nested_json_value(_NotJSONObj, _) ->
     throw({not_found, json_mismatch}).
 
-proplist_apply_field(H, L) ->
-    {R} = json_apply_field(H, {L}),
-    R.
-
-json_apply_field(H, {L}) ->
-    json_apply_field(H, L, []).
-json_apply_field({Key, NewValue}, [{Key, _OldVal} | Headers], Acc) ->
-    json_apply_field({Key, NewValue}, Headers, Acc);
-json_apply_field({Key, NewValue}, [{OtherKey, OtherVal} | Headers], Acc) ->
-    json_apply_field({Key, NewValue}, Headers, [{OtherKey, OtherVal} | Acc]);
-json_apply_field({Key, NewValue}, [], Acc) ->
-    {[{Key, NewValue}|Acc]}.
+proplist_apply_field({K, _V} = KV, L) ->
+    lists:keystore(K, 1, L, KV).
+
+json_apply_field({K, _V} = KV, {L}) ->
+    {lists:keystore(K, 1, L, KV)}.
 
 json_user_ctx(#db{name=DbName, user_ctx=Ctx}) ->
     {[{<<"db">>, DbName},



Mime
View raw message