mirror of https://github.com/google/pebble
spelling: contiguous
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
parent
74d9fc2ef5
commit
e3dd54fda9
|
@ -143,8 +143,8 @@ bool circular_buffer_read_or_copy(const CircularBuffer* buffer, uint8_t **data_o
|
||||||
if (buffer->data_length < length) {
|
if (buffer->data_length < length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const uint16_t continguous_length = (buffer->buffer_size - buffer->read_index);
|
const uint16_t contiguous_length = (buffer->buffer_size - buffer->read_index);
|
||||||
const bool should_malloc_and_copy = (length > continguous_length);
|
const bool should_malloc_and_copy = (length > contiguous_length);
|
||||||
*caller_should_free = should_malloc_and_copy;
|
*caller_should_free = should_malloc_and_copy;
|
||||||
if (should_malloc_and_copy) {
|
if (should_malloc_and_copy) {
|
||||||
*data_out = (uint8_t *) malloc_imp(length);
|
*data_out = (uint8_t *) malloc_imp(length);
|
||||||
|
|
|
@ -213,7 +213,7 @@ void test_circular_buffer__read_or_copy_returns_false_when_length_is_too_long(vo
|
||||||
malloc, &caller_should_free));
|
malloc, &caller_should_free));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_circular_buffer__read_or_copy_doesnt_copy_when_already_continguously_stored(void) {
|
void test_circular_buffer__read_or_copy_doesnt_copy_when_already_contiguously_stored(void) {
|
||||||
CircularBuffer buffer;
|
CircularBuffer buffer;
|
||||||
uint8_t storage[8];
|
uint8_t storage[8];
|
||||||
circular_buffer_init(&buffer, storage, sizeof(storage));
|
circular_buffer_init(&buffer, storage, sizeof(storage));
|
||||||
|
@ -230,7 +230,7 @@ static void *prv_oom_malloc(size_t length) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_circular_buffer__read_or_copy_does_copy_when_not_continguously_stored(void) {
|
void test_circular_buffer__read_or_copy_does_copy_when_not_contiguously_stored(void) {
|
||||||
CircularBuffer buffer;
|
CircularBuffer buffer;
|
||||||
uint8_t storage[8];
|
uint8_t storage[8];
|
||||||
circular_buffer_init(&buffer, storage, sizeof(storage));
|
circular_buffer_init(&buffer, storage, sizeof(storage));
|
||||||
|
|
Loading…
Reference in New Issue