projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: missing errno.h include in time.h compat header
[lttng-tools.git]
/
src
/
common
/
dynamic-buffer.c
diff --git
a/src/common/dynamic-buffer.c
b/src/common/dynamic-buffer.c
index 9ed16514fe64fa84dc735f15de862ca662a04fef..4f1116213a55dce6ec54be42efec2519f35a280e 100644
(file)
--- a/
src/common/dynamic-buffer.c
+++ b/
src/common/dynamic-buffer.c
@@
-20,6
+20,10
@@
#include <common/utils.h>
#include <assert.h>
#include <common/utils.h>
#include <assert.h>
+/*
+ * Round to (upper) power of two, val is returned if it already is a power of
+ * two.
+ */
static
size_t round_to_power_of_2(size_t val)
{
static
size_t round_to_power_of_2(size_t val)
{
@@
-55,11
+59,11
@@
int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer,
goto end;
}
goto end;
}
- assert(buffer->capacity >= buffer->size);
- if (buffer->capacity < (len + buffer->size)) {
+ assert(buffer->
_
capacity >= buffer->size);
+ if (buffer->
_
capacity < (len + buffer->size)) {
ret = lttng_dynamic_buffer_set_capacity(buffer,
ret = lttng_dynamic_buffer_set_capacity(buffer,
- buffer->capacity +
- (len - (buffer->capacity - buffer->size)));
+ buffer->
_
capacity +
+ (len - (buffer->
_
capacity - buffer->size)));
if (ret) {
goto end;
}
if (ret) {
goto end;
}
@@
-100,9
+104,9
@@
int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer,
goto end;
}
goto end;
}
- if (new_size > buffer->capacity) {
+ if (new_size > buffer->
_
capacity) {
size_t original_size = buffer->size;
size_t original_size = buffer->size;
- size_t original_capacity = buffer->capacity;
+ size_t original_capacity = buffer->
_
capacity;
ret = lttng_dynamic_buffer_set_capacity(buffer, new_size);
if (ret) {
ret = lttng_dynamic_buffer_set_capacity(buffer, new_size);
if (ret) {
@@
-151,7
+155,7
@@
int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer,
goto end;
}
goto end;
}
- if (new_capacity == buffer->capacity) {
+ if (new_capacity == buffer->
_
capacity) {
goto end;
}
goto end;
}
@@
-162,7
+166,7
@@
int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer,
goto end;
}
buffer->data = new_buf;
goto end;
}
buffer->data = new_buf;
- buffer->capacity = new_capacity;
+ buffer->
_
capacity = new_capacity;
end:
return ret;
}
end:
return ret;
}
@@
-174,6
+178,6
@@
void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer)
return;
}
buffer->size = 0;
return;
}
buffer->size = 0;
- buffer->capacity = 0;
+ buffer->
_
capacity = 0;
free(buffer->data);
}
free(buffer->data);
}
This page took
0.024888 seconds
and
4
git commands to generate.