*/
#include <common/dynamic-buffer.h>
-#include <common/macros.h>
#include <common/utils.h>
#include <assert.h>
return rounded;
}
+LTTNG_HIDDEN
void lttng_dynamic_buffer_init(struct lttng_dynamic_buffer *buffer)
{
assert(buffer);
memset(buffer, 0, sizeof(*buffer));
}
+LTTNG_HIDDEN
int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer,
const void *buf, size_t len)
{
return ret;
}
+LTTNG_HIDDEN
int lttng_dynamic_buffer_append_buffer(struct lttng_dynamic_buffer *dst_buffer,
struct lttng_dynamic_buffer *src_buffer)
{
return ret;
}
+LTTNG_HIDDEN
int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer,
size_t new_size)
{
return ret;
}
+LTTNG_HIDDEN
int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer,
size_t demanded_capacity)
{
}
/* Release any memory used by the dynamic buffer. */
+LTTNG_HIDDEN
void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer)
{
if (!buffer) {
#include <stddef.h>
#include <stdint.h>
+#include <common/macros.h>
struct lttng_dynamic_buffer {
char *data;
* Initialize a dynamic buffer. This performs no allocation and is meant
* to be used instead of memset or explicit initialization of the buffer.
*/
+LTTNG_HIDDEN
void lttng_dynamic_buffer_init(struct lttng_dynamic_buffer *buffer);
/*
* (after its current "size"). The dynamic buffer's size is increased by
* "len", and its capacity is adjusted automatically.
*/
+LTTNG_HIDDEN
int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer,
const void *buf, size_t len);
* dynamic buffer as the source buffer. The source buffer's size is used in lieu
* of "len".
*/
+LTTNG_HIDDEN
int lttng_dynamic_buffer_append_buffer(struct lttng_dynamic_buffer *dst_buffer,
struct lttng_dynamic_buffer *src_buffer);
* NOTE: It is striclty _invalid_ to access memory after _size_, regardless
* of prior calls to set_capacity().
*/
+LTTNG_HIDDEN
int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer,
size_t new_size);
*
* If the current size > new_capacity, the operation will fail.
*/
+LTTNG_HIDDEN
int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer,
size_t new_capacity);
/* Release any memory used by the dynamic buffer. */
+LTTNG_HIDDEN
void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer);
#endif /* LTTNG_DYNAMIC_BUFFER_H */