rnewson commented on code in PR #5588:
URL: https://github.com/apache/couchdb/pull/5588#discussion_r2189958103


##########
src/couch/src/couch_util.erl:
##########
@@ -228,8 +228,17 @@ get_value(Key, List, Default) ->
             Default
     end.
 
-set_value(Key, List, Value) ->
-    lists:keyreplace(Key, 1, List, {Key, Value}).
+% insert or update a {Key, Value} tuple in a list of tuples
+-spec set_value(Key, TupleList1, Value) -> TupleList2 when
+    Key :: term(),
+    TupleList1 :: [Tuple],
+    Value :: any(),
+    TupleList2 :: [Tuple].
+set_value(Key, TupleList1, Value) ->
+    TupleList2 = [{Key, Value} | TupleList1],

Review Comment:
   https://www.erlang.org/doc/apps/stdlib/lists.html#keystore/4



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to