]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon: fixed minor linter problems
authorMarek Vavruša <mvavrusa@cloudflare.com>
Fri, 12 Jan 2018 06:15:16 +0000 (22:15 -0800)
committerMarek Vavruša <mvavrusa@cloudflare.com>
Fri, 12 Jan 2018 06:18:37 +0000 (22:18 -0800)
daemon/bindings.c
daemon/io.c
daemon/main.c
daemon/network.c
daemon/worker.c

index 9da34be011843bd67afe988f75d101194b7e4be9..9da6f0f56d55f0bd40858fb6e1694747574ec560 100644 (file)
@@ -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];
index d8a6efb9e1b701fb90ca2dd76d6765e3794320e6..64de774c2d495cf6f315188b6af8f76010ebf257 100644 (file)
@@ -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)
index 3f22a28d1e01f33626c528e335353b47a2c6d75c..916fcf381a4b4867191c11b1f546642fbb73a1ee 100644 (file)
@@ -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);
index ff8004baea13ba1a967b8686b13fc7a982af35a2..c9adbd231895836b381223e5e4225fb8d9bff502 100644 (file)
@@ -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);
                }
index 0569d3b61a8ec2ac530e15104e37557f08083480..34c55d4a5659d5321117f34fdab354154536c0b5 100644 (file)
@@ -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);
        }