blob: 8763be2ee1c9e698a77d6d41e30bd21a1cba06cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "../../include/std/buffer_view.h"
#include "../../include/std/mem.h"
#include <string.h>
BufferView create_buffer_view_null(void) {
BufferView buffer_view;
buffer_view.data = NULL;
buffer_view.size = 0;
return buffer_view;
}
BufferView create_buffer_view(const char *data, usize size) {
BufferView buffer_view;
buffer_view.data = data;
buffer_view.size = size;
return buffer_view;
}
BufferView create_buffer_view_auto(const char *data) {
BufferView buffer_view;
buffer_view.data = data;
buffer_view.size = strlen(data);
return buffer_view;
}
bool buffer_view_equals(const BufferView *self, const BufferView *other) {
return self->size == other->size && am_memeql(self->data, other->data, self->size);
}
|