Clean-up: coding style fixes in dynamic-buffer.c
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Jun 2020 17:00:16 +0000 (13:00 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Jun 2020 21:30:49 +0000 (17:30 -0400)
1) An empty line is expected before any statement after a scope is
   closed
2) Variables should be marked const where possible.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I803e62fd759348416faae0bc108cacc726ce64da

src/common/dynamic-buffer.c

index b6544e62ba5f3f646bd9bd1630a9ca5668b5f190..26d318dcdf3c1a3ec6d570b0de3d26a58bd37d36 100644 (file)
 static
 size_t round_to_power_of_2(size_t val)
 {
-       int order;
        size_t rounded;
+       const int order = utils_get_count_order_u64(val);
 
-       order = utils_get_count_order_u64(val);
        assert(order >= 0);
        rounded = (1ULL << order);
        assert(rounded >= val);
@@ -135,6 +134,7 @@ int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer,
                 * size _before_ making such calls.
                 */
        }
+
        buffer->size = new_size;
 end:
        return ret;
@@ -168,6 +168,7 @@ int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer,
                ret = -1;
                goto end;
        }
+
        buffer->data = new_buf;
        buffer->_capacity = new_capacity;
 end:
@@ -181,6 +182,7 @@ void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer)
        if (!buffer) {
                return;
        }
+
        buffer->size = 0;
        buffer->_capacity = 0;
        free(buffer->data);
@@ -193,5 +195,6 @@ size_t lttng_dynamic_buffer_get_capacity_left(
        if (!buffer) {
                return 0;
        }
+
        return buffer->_capacity - buffer->size;
 }
This page took 0.034694 seconds and 4 git commands to generate.