willholley commented on code in PR #5588:
URL: https://github.com/apache/couchdb/pull/5588#discussion_r2190804397
##########
src/couch/src/couch_util.erl:
##########
@@ -228,8 +228,14 @@ 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) ->
+ lists:keystore(Key, 1, TupleList1, {Key, Value}).
Review Comment:
yes - I noticed it was only used here. Perhaps we'd want to go through the
codebase and use it elsewhere but that's a separate PR.
--
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]