]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/generic/queue: remove a ssize_t cast
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 2 Nov 2018 11:30:32 +0000 (12:30 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 2 Nov 2018 12:22:53 +0000 (13:22 +0100)
The Alpine-based Docker image wouldn't compile.
I can't see a reason for the cast now - it's a sum of compile-time
constants, and very unlikely to overflow on changes in code or platform.

lib/generic/queue.c

index 7bda790158ce8af86b479d3e380d025e8509ed62..45657c7c52f8f619da412737e0f1a002d6a501a6 100644 (file)
@@ -25,7 +25,7 @@ KR_EXPORT void queue_init_impl(struct queue *q, size_t item_size)
        /* Take 128 B (two x86 cache lines), except a small margin
         * that the allocator can use for its overhead.
         * Normally (64-bit pointers) this means 16 B header + 13*8 B data. */
-       q->chunk_cap = ( ((ssize_t)128) - offsetof(struct queue_chunk, data)
+       q->chunk_cap = (128 - offsetof(struct queue_chunk, data)
                        - sizeof(size_t)
                        ) / item_size;
        if (!q->chunk_cap) q->chunk_cap = 1; /* item_size big enough by itself */