src/util/yp_buffer.c in yarp-0.7.0 vs src/util/yp_buffer.c in yarp-0.8.0
- old
+ new
@@ -1,16 +1,34 @@
#include "yarp/util/yp_buffer.h"
#define YP_BUFFER_INITIAL_SIZE 1024
+// Return the size of the yp_buffer_t struct.
+size_t
+yp_buffer_sizeof(void) {
+ return sizeof(yp_buffer_t);
+}
+
// Initialize a yp_buffer_t with its default values.
bool
yp_buffer_init(yp_buffer_t *buffer) {
buffer->length = 0;
buffer->capacity = YP_BUFFER_INITIAL_SIZE;
buffer->value = (char *) malloc(YP_BUFFER_INITIAL_SIZE);
return buffer->value != NULL;
+}
+
+// Return the value of the buffer.
+char *
+yp_buffer_value(yp_buffer_t *buffer) {
+ return buffer->value;
+}
+
+// Return the length of the buffer.
+size_t
+yp_buffer_length(yp_buffer_t *buffer) {
+ return buffer->length;
}
// Append the given amount of space to the buffer.
static inline void
yp_buffer_append_length(yp_buffer_t *buffer, size_t length) {