Skip to content

Commit

Permalink
Remove redundant casts to same type
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalswift authored and cdecker committed Feb 21, 2018
1 parent 369d3ab commit 3dbace3
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gossipd/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions lightningd/bitcoind.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion lightningd/chaintopology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions lightningd/dev_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions lightningd/gossip_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions lightningd/jsonrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -511,15 +511,15 @@ 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;
}
if (cmd->deprecated && !deprecated_apis) {
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;
}
Expand Down
8 changes: 4 additions & 4 deletions lightningd/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions lightningd/payalgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 3dbace3

Please sign in to comment.