aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-12-04 17:33:18 +0200
committerRiccardo Spagni <ric@spagni.net>2018-12-04 17:33:19 +0200
commit81418cb281c44481fc4137257df8e39623d94885 (patch)
tree1e1ac74513bb5128de98949eb4a15bfb61997c53 /src/rpc
parentMerge pull request #4892 (diff)
parentwallet_rpc_server: do not use RPC data if the call failed (diff)
downloadmonero-81418cb281c44481fc4137257df8e39623d94885.tar.xz
Merge pull request #4894
aee7a4e3 wallet_rpc_server: do not use RPC data if the call failed (moneromooo-monero) 1a0733e5 windows_service: fix memory leak (moneromooo-monero) 0dac3c64 unit_tests: do not rethrow a copy of an exception (moneromooo-monero) 5d9915ab cryptonote: fix get_unit for non default settings (moneromooo-monero) d4f50cb1 remove some unused code (moneromooo-monero) 61163971 a few minor (but easy) performance tweaks (moneromooo-monero) 30023074 tests: slow_memmem now returns size_t (moneromooo-monero)
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp2
-rw-r--r--src/rpc/daemon_messages.cpp72
2 files changed, 1 insertions, 73 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 1bb353bb4..13157f3d4 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -1028,7 +1028,7 @@ namespace cryptonote
//------------------------------------------------------------------------------------------------------------------------------
// equivalent of strstr, but with arbitrary bytes (ie, NULs)
// This does not differentiate between "not found" and "found at offset 0"
- uint64_t slow_memmem(const void* start_buff, size_t buflen,const void* pat,size_t patlen)
+ size_t slow_memmem(const void* start_buff, size_t buflen,const void* pat,size_t patlen)
{
const void* buf = start_buff;
const void* end=(const char*)buf+buflen;
diff --git a/src/rpc/daemon_messages.cpp b/src/rpc/daemon_messages.cpp
index fa848cff4..7c7442014 100644
--- a/src/rpc/daemon_messages.cpp
+++ b/src/rpc/daemon_messages.cpp
@@ -177,8 +177,6 @@ rapidjson::Value GetTransactions::Request::toJson(rapidjson::Document& doc) cons
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, tx_hashes, tx_hashes);
return val;
@@ -193,8 +191,6 @@ rapidjson::Value GetTransactions::Response::toJson(rapidjson::Document& doc) con
{
rapidjson::Value val(rapidjson::kObjectType);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, txs, txs);
INSERT_INTO_JSON_OBJECT(val, doc, missed_hashes, missed_hashes);
@@ -212,8 +208,6 @@ rapidjson::Value KeyImagesSpent::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images);
return val;
@@ -228,8 +222,6 @@ rapidjson::Value KeyImagesSpent::Response::toJson(rapidjson::Document& doc) cons
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, spent_status, spent_status);
return val;
@@ -245,8 +237,6 @@ rapidjson::Value GetTxGlobalOutputIndices::Request::toJson(rapidjson::Document&
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, tx_hash, tx_hash);
return val;
@@ -261,8 +251,6 @@ rapidjson::Value GetTxGlobalOutputIndices::Response::toJson(rapidjson::Document&
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, output_indices, output_indices);
return val;
@@ -277,8 +265,6 @@ rapidjson::Value SendRawTx::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, tx, tx);
INSERT_INTO_JSON_OBJECT(val, doc, relay, relay);
@@ -295,8 +281,6 @@ rapidjson::Value SendRawTx::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, relayed, relayed);
return val;
@@ -312,8 +296,6 @@ rapidjson::Value StartMining::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, miner_address, miner_address);
INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count);
INSERT_INTO_JSON_OBJECT(val, doc, do_background_mining, do_background_mining);
@@ -372,8 +354,6 @@ rapidjson::Value MiningStatus::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, active, active);
INSERT_INTO_JSON_OBJECT(val, doc, speed, speed);
INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count);
@@ -406,8 +386,6 @@ rapidjson::Value GetInfo::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, info, info);
return val;
@@ -423,8 +401,6 @@ rapidjson::Value SaveBC::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
return val;
}
@@ -436,8 +412,6 @@ rapidjson::Value SaveBC::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
return val;
}
@@ -450,8 +424,6 @@ rapidjson::Value GetBlockHash::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, height, height);
return val;
@@ -466,8 +438,6 @@ rapidjson::Value GetBlockHash::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, hash, hash);
return val;
@@ -483,8 +453,6 @@ rapidjson::Value GetLastBlockHeader::Request::toJson(rapidjson::Document& doc) c
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
return val;
}
@@ -496,8 +464,6 @@ rapidjson::Value GetLastBlockHeader::Response::toJson(rapidjson::Document& doc)
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, header, header);
return val;
@@ -513,8 +479,6 @@ rapidjson::Value GetBlockHeaderByHash::Request::toJson(rapidjson::Document& doc)
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, hash, hash);
return val;
@@ -529,8 +493,6 @@ rapidjson::Value GetBlockHeaderByHash::Response::toJson(rapidjson::Document& doc
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, header, header);
return val;
@@ -546,8 +508,6 @@ rapidjson::Value GetBlockHeaderByHeight::Request::toJson(rapidjson::Document& do
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, height, height);
return val;
@@ -562,8 +522,6 @@ rapidjson::Value GetBlockHeaderByHeight::Response::toJson(rapidjson::Document& d
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, header, header);
return val;
@@ -579,8 +537,6 @@ rapidjson::Value GetBlockHeadersByHeight::Request::toJson(rapidjson::Document& d
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, heights, heights);
return val;
@@ -595,8 +551,6 @@ rapidjson::Value GetBlockHeadersByHeight::Response::toJson(rapidjson::Document&
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, headers, headers);
return val;
@@ -612,8 +566,6 @@ rapidjson::Value GetPeerList::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
return val;
}
@@ -625,8 +577,6 @@ rapidjson::Value GetPeerList::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, white_list, white_list);
INSERT_INTO_JSON_OBJECT(val, doc, gray_list, gray_list);
@@ -679,8 +629,6 @@ rapidjson::Value GetTransactionPool::Response::toJson(rapidjson::Document& doc)
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, transactions, transactions);
INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images);
@@ -698,8 +646,6 @@ rapidjson::Value HardForkInfo::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, version, version);
return val;
@@ -714,8 +660,6 @@ rapidjson::Value HardForkInfo::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, info, info);
return val;
@@ -731,8 +675,6 @@ rapidjson::Value GetOutputHistogram::Request::toJson(rapidjson::Document& doc) c
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
INSERT_INTO_JSON_OBJECT(val, doc, min_count, min_count);
INSERT_INTO_JSON_OBJECT(val, doc, max_count, max_count);
@@ -755,8 +697,6 @@ rapidjson::Value GetOutputHistogram::Response::toJson(rapidjson::Document& doc)
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, histogram, histogram);
return val;
@@ -772,8 +712,6 @@ rapidjson::Value GetOutputKeys::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, outputs, outputs);
return val;
@@ -788,8 +726,6 @@ rapidjson::Value GetOutputKeys::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, keys, keys);
return val;
@@ -814,8 +750,6 @@ rapidjson::Value GetRPCVersion::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, version, version);
return val;
@@ -830,8 +764,6 @@ rapidjson::Value GetFeeEstimate::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, num_grace_blocks, num_grace_blocks);
return val;
@@ -846,8 +778,6 @@ rapidjson::Value GetFeeEstimate::Response::toJson(rapidjson::Document& doc) cons
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
-
INSERT_INTO_JSON_OBJECT(val, doc, estimated_base_fee, estimated_base_fee);
INSERT_INTO_JSON_OBJECT(val, doc, fee_mask, fee_mask);
INSERT_INTO_JSON_OBJECT(val, doc, size_scale, size_scale);
@@ -867,7 +797,6 @@ void GetFeeEstimate::Response::fromJson(rapidjson::Value& val)
rapidjson::Value GetOutputDistribution::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
INSERT_INTO_JSON_OBJECT(val, doc, from_height, from_height);
@@ -888,7 +817,6 @@ void GetOutputDistribution::Request::fromJson(rapidjson::Value& val)
rapidjson::Value GetOutputDistribution::Response::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);
- auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, status, status);
INSERT_INTO_JSON_OBJECT(val, doc, distributions, distributions);