nickva commented on code in PR #40:
URL: https://github.com/apache/couchdb-config/pull/40#discussion_r945937157


##########
src/config_util.erl:
##########
@@ -72,3 +73,16 @@ fix_path_list(["."|Rest], Acc) ->
     fix_path_list(Rest, Acc);
 fix_path_list([Dir | Rest], Acc) ->
     fix_path_list(Rest, [Dir | Acc]).
+
+% Remove leading and trailing ws from string
+% Implementation used from mochiweb_headers for speed
+% discussion https://github.com/mochi/mochiweb/pull/247
+trim_leading_and_trailing_ws(S) ->
+    trim_and_reverse(trim_and_reverse(S, false), false).
+
+trim_and_reverse([S | Rest], Reversed) when S=:=$ ; S=:=$\n; S=:=$\t ->
+    trim_and_reverse(Rest, Reversed);
+trim_and_reverse(V, false) ->
+    trim_and_reverse(lists:reverse(V), true);
+trim_and_reverse(V, true) ->
+    V.

Review Comment:
   Since we're supporting Erlang 20+ could we use string:trim/1?



-- 
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