Commit 97449691 authored by Marek Vavruša's avatar Marek Vavruša

daemon: fixed minor linter problems

parent 48100e84
......@@ -913,7 +913,7 @@ static int cache_prefixed(struct kr_cache *cache, const char *args, knot_db_val_
{
/* Decode parameters */
uint8_t namespace = 'R';
char *extra = (char *)strchr(args, ' ');
char *extra = strchr(args, ' ');
if (extra != NULL) {
extra[0] = '\0';
namespace = extra[1];
......
......@@ -170,14 +170,14 @@ void udp_recv(uv_udp_t *handle, ssize_t nread, const uv_buf_t *buf,
static int udp_bind_finalize(uv_handle_t *handle)
{
check_bufsize((uv_handle_t *)handle);
check_bufsize(handle);
/* Handle is already created, just create context. */
struct session *session = session_new();
assert(session);
session->outgoing = false;
session->handle = handle;
handle->data = session;
return io_start_read((uv_handle_t *)handle);
return io_start_read(handle);
}
int udp_bind(uv_udp_t *handle, struct sockaddr *addr)
......
......@@ -295,7 +295,7 @@ static const char *set_addr(char *addr, int *port)
p = strchr(addr, '#');
}
if (p) {
*port = atoi(p + 1);
*port = strtol(p + 1, NULL, 10);
*p = '\0';
}
......@@ -465,17 +465,17 @@ int main(int argc, char **argv)
array_push(tls_set, optarg);
break;
case 'S':
array_push(fd_set, atoi(optarg));
array_push(fd_set, strtol(optarg, NULL, 10));
break;
case 'T':
array_push(tls_fd_set, atoi(optarg));
array_push(tls_fd_set, strtol(optarg, NULL, 10));
break;
case 'c':
config = optarg;
break;
case 'f':
g_interactive = false;
forks = atoi(optarg);
forks = strtol(optarg, NULL, 10);
if (forks <= 0) {
kr_log_error("[system] error '-f' requires a positive"
" number, not '%s'\n", optarg);
......
......@@ -140,7 +140,7 @@ static int open_endpoint(struct network *net, struct endpoint *ep, struct sockad
{
int ret = 0;
if (flags & NET_UDP) {
ep->udp = malloc(sizeof(uv_handles_t));
ep->udp = malloc(sizeof(*ep->udp));
if (!ep->udp) {
return kr_error(ENOMEM);
}
......@@ -153,7 +153,7 @@ static int open_endpoint(struct network *net, struct endpoint *ep, struct sockad
ep->flags |= NET_UDP;
}
if (flags & NET_TCP) {
ep->tcp = malloc(sizeof(uv_handles_t));
ep->tcp = malloc(sizeof(*ep->tcp));
if (!ep->tcp) {
return kr_error(ENOMEM);
}
......@@ -185,7 +185,7 @@ static int open_endpoint_fd(struct network *net, struct endpoint *ep, int fd, in
if (ep->udp) {
return kr_error(EEXIST);
}
ep->udp = malloc(sizeof(uv_handles_t));// malloc(sizeof(*ep->udp));
ep->udp = malloc(sizeof(*ep->udp));
if (!ep->udp) {
return kr_error(ENOMEM);
}
......@@ -201,7 +201,7 @@ static int open_endpoint_fd(struct network *net, struct endpoint *ep, int fd, in
if (ep->tcp) {
return kr_error(EEXIST);
}
ep->tcp = malloc(sizeof(uv_handles_t));
ep->tcp = malloc(sizeof(*ep->tcp));
if (!ep->tcp) {
return kr_error(ENOMEM);
}
......
......@@ -820,8 +820,7 @@ static int qr_task_on_send(struct qr_task *task, uv_handle_t *handle, int status
}
if (session->waiting.len > 0) {
struct qr_task *t = session->waiting.at[0];
int ret = qr_task_send(t, (uv_handle_t *)handle,
&session->peer.ip, t->pktbuf);
int ret = qr_task_send(t, handle, &session->peer.ip, t->pktbuf);
if (ret == kr_ok()) {
uv_timer_t *timer = &session->timeout;
uv_timer_stop(timer);
......@@ -1055,7 +1054,7 @@ static void on_connect(uv_connect_t *req, int status)
struct session *session = handle->data;
union inaddr *peer = &session->peer;
uv_timer_stop((uv_timer_t *)&session->timeout);
uv_timer_stop(&session->timeout);
if (status == UV_ECANCELED) {
worker_del_tcp_waiting(worker, &peer->ip);
......@@ -1308,7 +1307,7 @@ static void on_retransmit(uv_timer_t *req)
static int timer_start(struct session *session, uv_timer_cb cb,
uint64_t timeout, uint64_t repeat)
{
uv_timer_t *timer = (uv_timer_t *)&session->timeout;
uv_timer_t *timer = &session->timeout;
assert(timer->data == session);
int ret = uv_timer_start(timer, cb, timeout, repeat);
if (ret != 0) {
......@@ -1863,7 +1862,7 @@ int worker_end_tcp(struct worker_ctx *worker, uv_handle_t *handle)
* borrowed the task from parent session. */
struct session *session = handle->data;
if (session->outgoing) {
worker_submit(worker, (uv_handle_t *)handle, NULL, NULL);
worker_submit(worker, handle, NULL, NULL);
} else {
discard_buffered(session);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment