Commit e056d37d by Marcus Winter

mtapi_network_c: add clear function to buffer, changed input argument to push_rawdata to const

parent ad97663c
...@@ -52,6 +52,12 @@ void embb_mtapi_network_buffer_finalize( ...@@ -52,6 +52,12 @@ void embb_mtapi_network_buffer_finalize(
} }
} }
void embb_mtapi_network_buffer_clear(
embb_mtapi_network_buffer_t * that) {
that->position = 0;
that->size = 0;
}
int embb_mtapi_network_buffer_push_back_int8( int embb_mtapi_network_buffer_push_back_int8(
embb_mtapi_network_buffer_t * that, embb_mtapi_network_buffer_t * that,
int8_t value) { int8_t value) {
...@@ -88,7 +94,7 @@ int embb_mtapi_network_buffer_push_back_int32( ...@@ -88,7 +94,7 @@ int embb_mtapi_network_buffer_push_back_int32(
int embb_mtapi_network_buffer_push_back_rawdata( int embb_mtapi_network_buffer_push_back_rawdata(
embb_mtapi_network_buffer_t * that, embb_mtapi_network_buffer_t * that,
int32_t size, int32_t size,
void * rawdata) { void const * rawdata) {
if (that->size + size > that->capacity) { if (that->size + size > that->capacity) {
return 0; return 0;
} }
......
...@@ -52,6 +52,10 @@ void embb_mtapi_network_buffer_finalize( ...@@ -52,6 +52,10 @@ void embb_mtapi_network_buffer_finalize(
embb_mtapi_network_buffer_t * that embb_mtapi_network_buffer_t * that
); );
void embb_mtapi_network_buffer_clear(
embb_mtapi_network_buffer_t * that
);
int embb_mtapi_network_buffer_push_back_int8( int embb_mtapi_network_buffer_push_back_int8(
embb_mtapi_network_buffer_t * that, embb_mtapi_network_buffer_t * that,
int8_t value int8_t value
...@@ -70,7 +74,7 @@ int embb_mtapi_network_buffer_push_back_int32( ...@@ -70,7 +74,7 @@ int embb_mtapi_network_buffer_push_back_int32(
int embb_mtapi_network_buffer_push_back_rawdata( int embb_mtapi_network_buffer_push_back_rawdata(
embb_mtapi_network_buffer_t * that, embb_mtapi_network_buffer_t * that,
int32_t size, int32_t size,
void * rawdata void const * rawdata
); );
int embb_mtapi_network_buffer_pop_front_int8( int embb_mtapi_network_buffer_pop_front_int8(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment