You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/01/17 23:44:36 UTC

[09/50] git commit: Use queue:peek/1 - more efficient than hd(queue:to_list(Queue))

Use queue:peek/1 - more efficient than hd(queue:to_list(Queue))


Project: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/commit/ee06a43d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/tree/ee06a43d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/diff/ee06a43d

Branch: refs/heads/import
Commit: ee06a43ddb3a32443910f89227adced433c71c5d
Parents: 5be7075
Author: Filipe David Manana <fd...@apache.org>
Authored: Sun May 15 04:58:02 2011 +0100
Committer: Filipe David Manana <fd...@apache.org>
Committed: Sun May 15 12:25:26 2011 +0100

----------------------------------------------------------------------
 src/ibrowse_http_client.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/blob/ee06a43d/src/ibrowse_http_client.erl
----------------------------------------------------------------------
diff --git a/src/ibrowse_http_client.erl b/src/ibrowse_http_client.erl
index 65f3bbc..321753d 100644
--- a/src/ibrowse_http_client.erl
+++ b/src/ibrowse_http_client.erl
@@ -1366,10 +1366,10 @@ reset_state(State) ->
                }.
 
 set_cur_request(#state{reqs = Reqs, socket = Socket} = State) ->
-    case queue:to_list(Reqs) of
-        [] ->
+    case queue:peek(Reqs) of
+        empty ->
             State#state{cur_req = undefined};
-        [#request{caller_controls_socket = Ccs} = NextReq | _] ->
+        {value, #request{caller_controls_socket = Ccs} = NextReq} ->
             case Ccs of
                 true ->
                     do_setopts(Socket, [{active, once}], State);