]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/session2 wire_buf_init(): don't return anything
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 29 May 2025 09:07:40 +0000 (11:07 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 29 May 2025 09:07:40 +0000 (11:07 +0200)
The function does not return anything but success,
and I don't see any plans for changing that,
so why should the declaration suggest otherwise?

daemon/session2.c
daemon/session2.h

index 0916514db33ede44b9bbd1029363b9fc61d40e0e..60aee3ab81e4fd6d359774f615cf558a9d51251b 100644 (file)
@@ -730,7 +730,7 @@ enum protolayer_iter_cb_result protolayer_break(struct protolayer_iter_ctx *ctx,
 }
 
 
-int wire_buf_init(struct wire_buf *wb, size_t initial_size)
+void wire_buf_init(struct wire_buf *wb, size_t initial_size)
 {
        char *buf = malloc(initial_size);
        kr_require(buf);
@@ -739,8 +739,6 @@ int wire_buf_init(struct wire_buf *wb, size_t initial_size)
                .buf = buf,
                .size = initial_size
        };
-
-       return kr_ok();
 }
 
 void wire_buf_deinit(struct wire_buf *wb)
@@ -867,10 +865,9 @@ struct session2 *session2_new(enum session2_transport_type transport_type,
 
        memcpy(&s->layer_data, offsets, sizeof(offsets));
        queue_init(s->waiting);
-       int ret = wire_buf_init(&s->wire_buf, wire_buf_length);
-       kr_require(!ret);
+       wire_buf_init(&s->wire_buf, wire_buf_length);
 
-       ret = uv_timer_init(uv_default_loop(), &s->timer);
+       int ret = uv_timer_init(uv_default_loop(), &s->timer);
        kr_require(!ret);
        s->timer.data = s;
        session2_inc_refs(s); /* Session owns the timer */
index 32950dd4f3a63aef1500bd2e69b4936e1bf90d06..0b94a86911537ed6f303089d6218e9640e35215b 100644 (file)
@@ -147,7 +147,7 @@ struct wire_buf {
 
 /** Initializes the wire buffer with the specified `initial_size` and allocates
  * the underlying memory. */
-int wire_buf_init(struct wire_buf *wb, size_t initial_size);
+void wire_buf_init(struct wire_buf *wb, size_t initial_size);
 
 /** De-allocates the wire buffer's underlying memory (the struct itself is left
  * intact). */