mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
Remove redundant casts to same type
This commit is contained in:
parent
369d3ab46e
commit
3dbace3421
@ -815,7 +815,7 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
|
||||
if (replace_broadcast(rstate->broadcasts,
|
||||
&chan->msg_indexes[MSG_INDEX_CANNOUNCE],
|
||||
WIRE_CHANNEL_ANNOUNCEMENT,
|
||||
(u8*)tag, pending->announce))
|
||||
tag, pending->announce))
|
||||
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
||||
"Announcement %s was replaced?",
|
||||
tal_hex(trc, pending->announce));
|
||||
|
@ -358,7 +358,7 @@ static void process_sendrawtx(struct bitcoin_cli *bcli)
|
||||
{
|
||||
void (*cb)(struct bitcoind *bitcoind,
|
||||
int, const char *msg, void *) = bcli->cb;
|
||||
const char *msg = tal_strndup(bcli, (char *)bcli->output,
|
||||
const char *msg = tal_strndup(bcli, bcli->output,
|
||||
bcli->output_bytes);
|
||||
|
||||
log_debug(bcli->bitcoind->log, "sendrawtx exit %u, gave %s",
|
||||
@ -390,7 +390,7 @@ static void process_rawblock(struct bitcoin_cli *bcli)
|
||||
if (!blk)
|
||||
fatal("%s: bad block '%.*s'?",
|
||||
bcli_args(bcli),
|
||||
(int)bcli->output_bytes, (char *)bcli->output);
|
||||
(int)bcli->output_bytes, bcli->output);
|
||||
|
||||
cb(bcli->bitcoind, blk, bcli->cb_arg);
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ static void json_dev_setfees(struct command *cmd,
|
||||
if (!json_tok_number(buffer, ratetok[i],
|
||||
&topo->override_fee_rate[i])) {
|
||||
command_fail(cmd, "Invalid feerate %.*s",
|
||||
(int)(ratetok[i]->end - ratetok[i]->start),
|
||||
ratetok[i]->end - ratetok[i]->start,
|
||||
buffer + ratetok[i]->start);
|
||||
return;
|
||||
}
|
||||
|
@ -57,21 +57,21 @@ static void json_dev_ping(struct command *cmd,
|
||||
* ready to forward! */
|
||||
if (!json_tok_number(buffer, lentok, &len)) {
|
||||
command_fail(cmd, "'%.*s' is not a valid number",
|
||||
(int)(lentok->end - lentok->start),
|
||||
lentok->end - lentok->start,
|
||||
buffer + lentok->start);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_tok_number(buffer, pongbytestok, &pongbytes)) {
|
||||
command_fail(cmd, "'%.*s' is not a valid number",
|
||||
(int)(pongbytestok->end - pongbytestok->start),
|
||||
pongbytestok->end - pongbytestok->start,
|
||||
buffer + pongbytestok->start);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_tok_pubkey(buffer, idtok, &id)) {
|
||||
command_fail(cmd, "'%.*s' is not a valid pubkey",
|
||||
(int)(idtok->end - idtok->start),
|
||||
idtok->end - idtok->start,
|
||||
buffer + idtok->start);
|
||||
return;
|
||||
}
|
||||
|
@ -325,14 +325,14 @@ static void json_getroute(struct command *cmd, const char *buffer, const jsmntok
|
||||
|
||||
if (!json_tok_u64(buffer, msatoshitok, &msatoshi)) {
|
||||
command_fail(cmd, "'%.*s' is not a valid number",
|
||||
(int)(msatoshitok->end - msatoshitok->start),
|
||||
msatoshitok->end - msatoshitok->start,
|
||||
buffer + msatoshitok->start);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_tok_double(buffer, riskfactortok, &riskfactor)) {
|
||||
command_fail(cmd, "'%.*s' is not a valid double",
|
||||
(int)(riskfactortok->end - riskfactortok->start),
|
||||
riskfactortok->end - riskfactortok->start,
|
||||
buffer + riskfactortok->start);
|
||||
return;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ static void json_rhash(struct command *cmd,
|
||||
secrettok->end - secrettok->start,
|
||||
&secret, sizeof(secret))) {
|
||||
command_fail(cmd, "'%.*s' is not a valid 32-byte hex value",
|
||||
(int)(secrettok->end - secrettok->start),
|
||||
secrettok->end - secrettok->start,
|
||||
buffer + secrettok->start);
|
||||
return;
|
||||
}
|
||||
@ -511,7 +511,7 @@ static void parse_request(struct json_connection *jcon, const jsmntok_t tok[])
|
||||
command_fail_detailed(c,
|
||||
JSONRPC2_METHOD_NOT_FOUND, NULL,
|
||||
"Unknown command '%.*s'",
|
||||
(int)(method->end - method->start),
|
||||
method->end - method->start,
|
||||
jcon->buffer + method->start);
|
||||
return;
|
||||
}
|
||||
@ -519,7 +519,7 @@ static void parse_request(struct json_connection *jcon, const jsmntok_t tok[])
|
||||
command_fail_detailed(c,
|
||||
JSONRPC2_METHOD_NOT_FOUND, NULL,
|
||||
"Command '%.*s' is deprecated",
|
||||
(int)(method->end - method->start),
|
||||
method->end - method->start,
|
||||
jcon->buffer + method->start);
|
||||
return;
|
||||
}
|
||||
|
@ -733,14 +733,14 @@ static void json_sendpay(struct command *cmd,
|
||||
rhashtok->end - rhashtok->start,
|
||||
&rhash, sizeof(rhash))) {
|
||||
command_fail(cmd, "'%.*s' is not a valid sha256 hash",
|
||||
(int)(rhashtok->end - rhashtok->start),
|
||||
rhashtok->end - rhashtok->start,
|
||||
buffer + rhashtok->start);
|
||||
return;
|
||||
}
|
||||
|
||||
if (routetok->type != JSMN_ARRAY) {
|
||||
command_fail(cmd, "'%.*s' is not an array",
|
||||
(int)(routetok->end - routetok->start),
|
||||
routetok->end - routetok->start,
|
||||
buffer + routetok->start);
|
||||
return;
|
||||
}
|
||||
@ -755,7 +755,7 @@ static void json_sendpay(struct command *cmd,
|
||||
if (t->type != JSMN_OBJECT) {
|
||||
command_fail(cmd, "Route %zu '%.*s' is not an object",
|
||||
n_hops,
|
||||
(int)(t->end - t->start),
|
||||
t->end - t->start,
|
||||
buffer + t->start);
|
||||
return;
|
||||
}
|
||||
@ -851,7 +851,7 @@ static void json_listpayments(struct command *cmd, const char *buffer,
|
||||
rhashtok->end - rhashtok->start,
|
||||
rhash, sizeof(*rhash))) {
|
||||
command_fail(cmd, "'%.*s' is not a valid sha256 hash",
|
||||
(int)(rhashtok->end - rhashtok->start),
|
||||
rhashtok->end - rhashtok->start,
|
||||
buffer + rhashtok->start);
|
||||
return;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ static void json_pay(struct command *cmd,
|
||||
if (!json_tok_u64(buffer, msatoshitok, &msatoshi)) {
|
||||
command_fail(cmd,
|
||||
"msatoshi '%.*s' is not a valid number",
|
||||
(int)(msatoshitok->end-msatoshitok->start),
|
||||
msatoshitok->end-msatoshitok->start,
|
||||
buffer + msatoshitok->start);
|
||||
return;
|
||||
}
|
||||
@ -296,7 +296,7 @@ static void json_pay(struct command *cmd,
|
||||
if (riskfactortok
|
||||
&& !json_tok_double(buffer, riskfactortok, &riskfactor)) {
|
||||
command_fail(cmd, "'%.*s' is not a valid double",
|
||||
(int)(riskfactortok->end - riskfactortok->start),
|
||||
riskfactortok->end - riskfactortok->start,
|
||||
buffer + riskfactortok->start);
|
||||
return;
|
||||
}
|
||||
@ -305,7 +305,7 @@ static void json_pay(struct command *cmd,
|
||||
if (maxfeetok
|
||||
&& !json_tok_double(buffer, maxfeetok, &maxfeepercent)) {
|
||||
command_fail(cmd, "'%.*s' is not a valid double",
|
||||
(int)(maxfeetok->end - maxfeetok->start),
|
||||
maxfeetok->end - maxfeetok->start,
|
||||
buffer + maxfeetok->start);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user