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
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);
* size _before_ making such calls.
*/
}
+
buffer->size = new_size;
end:
return ret;
ret = -1;
goto end;
}
+
buffer->data = new_buf;
buffer->_capacity = new_capacity;
end:
if (!buffer) {
return;
}
+
buffer->size = 0;
buffer->_capacity = 0;
free(buffer->data);
if (!buffer) {
return 0;
}
+
return buffer->_capacity - buffer->size;
}