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 2008/08/27 22:20:32 UTC
svn commit: r689599 - in
/incubator/couchdb/branches/json_term_changes/src/couchdb: couch_httpd.erl
couch_rep.erl
Author: damien
Date: Wed Aug 27 13:20:32 2008
New Revision: 689599
URL: http://svn.apache.org/viewvc?rev=689599&view=rev
Log:
Remove unnecessary list:flatten calls (necessary for inets HTTP).
Modified:
incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl
incubator/couchdb/branches/json_term_changes/src/couchdb/couch_rep.erl
Modified: incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl?rev=689599&r1=689598&r2=689599&view=diff
==============================================================================
--- incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl (original)
+++ incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl Wed Aug 27 13:20:32 2008
@@ -523,18 +523,18 @@
(_Key, _Red, {AccSeparator,0,AccCount}) when AccCount == 0 ->
{stop, {AccSeparator,0,AccCount}};
(_Key, Red, {AccSeparator,0,AccCount}) when GroupLevel == 0 ->
- Json = lists:flatten(?JSON_ENCODE({[{key, null}, {value, Red}]})),
+ Json = ?JSON_ENCODE({[{key, null}, {value, Red}]}),
Resp:write_chunk(AccSeparator ++ Json),
{ok, {",",0,AccCount-1}};
(Key, Red, {AccSeparator,0,AccCount})
when is_integer(GroupLevel)
andalso is_list(Key) ->
- Json = lists:flatten(?JSON_ENCODE(
- {[{key, lists:sublist(Key, GroupLevel)},{value, Red}]})),
+ Json = ?JSON_ENCODE(
+ {[{key, lists:sublist(Key, GroupLevel)},{value, Red}]}),
Resp:write_chunk(AccSeparator ++ Json),
{ok, {",",0,AccCount-1}};
(Key, Red, {AccSeparator,0,AccCount}) ->
- Json = lists:flatten(?JSON_ENCODE({[{key, Key}, {value, Red}]})),
+ Json = ?JSON_ENCODE({[{key, Key}, {value, Red}]}),
Resp:write_chunk(AccSeparator ++ Json),
{ok, {",",0,AccCount-1}}
end, {"", Skip, Count}),
@@ -581,10 +581,10 @@
case Result of
{ok, Doc} ->
JsonDoc = couch_doc:to_json_obj(Doc, Options),
- Json = lists:flatten(?JSON_ENCODE({[{ok, JsonDoc}]})),
+ Json = ?JSON_ENCODE({[{ok, JsonDoc}]}),
Resp:write_chunk(AccSeparator ++ Json);
{{not_found, missing}, RevId} ->
- Json = lists:flatten(?JSON_ENCODE({[{"missing", RevId}]})),
+ Json = ?JSON_ENCODE({[{"missing", RevId}]}),
Resp:write_chunk(AccSeparator ++ Json)
end,
"," % AccSeparator now has a comma
@@ -972,7 +972,7 @@
lists:min([TotalViewCount - Offset, - AccCount]),
JsonBegin = io_lib:format("{\"total_rows\":~w,\"offset\":~w,\"rows\":[\r\n",
[TotalViewCount, Offset2]),
- Resp2:write_chunk(lists:flatten(JsonBegin)),
+ Resp2:write_chunk(JsonBegin),
JsonObj = {[{id, DocId}, {key, Key}, {value, Value}]},
{ok, {AccCount + 1, 0, Resp2, [?JSON_ENCODE(JsonObj) | AccRevRows]}};
{_, AccCount, _, Resp} ->
@@ -1001,11 +1001,11 @@
[TotalViewCount, Offset]),
JsonObj = {[{id, DocId}, {key, Key}, {value, Value}]},
- Resp2:write_chunk(lists:flatten(JsonBegin ++ ?JSON_ENCODE(JsonObj))),
+ Resp2:write_chunk(JsonBegin ++ ?JSON_ENCODE(JsonObj)),
{ok, {AccCount - 1, 0, Resp2, AccRevRows}};
{_, AccCount, _, Resp} when (AccCount > 0) ->
JsonObj = {[{id, DocId}, {key, Key}, {value, Value}]},
- Resp:write_chunk(",\r\n" ++ lists:flatten(?JSON_ENCODE(JsonObj))),
+ Resp:write_chunk(",\r\n" ++ ?JSON_ENCODE(JsonObj)),
{ok, {AccCount - 1, 0, Resp, AccRevRows}}
end
end,
@@ -1025,7 +1025,7 @@
]});
{ok, {_, _, Resp, AccRevRows}} ->
% end the view
- Resp:write_chunk(lists:flatten(AccRevRows) ++ "\r\n]}"),
+ Resp:write_chunk(AccRevRows ++ "\r\n]}"),
end_json_response(Resp);
Error ->
throw(Error)
Modified: incubator/couchdb/branches/json_term_changes/src/couchdb/couch_rep.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/json_term_changes/src/couchdb/couch_rep.erl?rev=689599&r1=689598&r2=689599&view=diff
==============================================================================
--- incubator/couchdb/branches/json_term_changes/src/couchdb/couch_rep.erl (original)
+++ incubator/couchdb/branches/json_term_changes/src/couchdb/couch_rep.erl Wed Aug 27 13:20:32 2008
@@ -272,7 +272,6 @@
enum_docs_since(DbUrl, StartSeq, InFun, InAcc) when is_list(DbUrl) ->
Url = DbUrl ++ "_all_docs_by_seq?count=100&startkey=" ++ integer_to_list(StartSeq),
{Results} = do_http_request(Url, get),
- io:format("Results:~p~n", [Results]),
DocInfoList=
lists:map(fun({RowInfoList}) ->
{RowValueProps} = proplists:get_value(<<"value">>, RowInfoList),