diff --git a/libs/esl/src/esl_buffer.c b/libs/esl/src/esl_buffer.c index 7ba3d5265d..173c9cb76c 100644 --- a/libs/esl/src/esl_buffer.c +++ b/libs/esl/src/esl_buffer.c @@ -82,10 +82,7 @@ ESL_DECLARE(esl_status_t) esl_buffer_create(esl_buffer_t **buffer, esl_size_t bl ESL_DECLARE(esl_size_t) esl_buffer_len(esl_buffer_t *buffer) { - assert(buffer != NULL); - if (!buffer){ - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); return buffer->datalen; @@ -94,10 +91,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_len(esl_buffer_t *buffer) ESL_DECLARE(esl_size_t) esl_buffer_freespace(esl_buffer_t *buffer) { - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); if (buffer->max_len) { return (esl_size_t) (buffer->max_len - buffer->used); @@ -108,10 +102,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_freespace(esl_buffer_t *buffer) ESL_DECLARE(esl_size_t) esl_buffer_inuse(esl_buffer_t *buffer) { - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); return buffer->used; } @@ -120,10 +111,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_seek(esl_buffer_t *buffer, esl_size_t datalen { esl_size_t reading = 0; - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); if (buffer->used < 1) { buffer->used = 0; @@ -144,10 +132,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_toss(esl_buffer_t *buffer, esl_size_t datalen { esl_size_t reading = 0; - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); if (buffer->used < 1) { buffer->used = 0; @@ -188,11 +173,8 @@ ESL_DECLARE(esl_size_t) esl_buffer_read(esl_buffer_t *buffer, void *data, esl_si { esl_size_t reading = 0; - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } - assert(data != NULL); + esl_assert(buffer != NULL); + esl_assert(data != NULL); if (buffer->used < 1) { @@ -218,7 +200,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_packet_count(esl_buffer_t *buffer) char *pe, *p, *e, *head = (char *) buffer->head; esl_size_t x = 0; - assert(buffer != NULL); + esl_assert(buffer != NULL); e = (head + buffer->used); @@ -241,8 +223,8 @@ ESL_DECLARE(esl_size_t) esl_buffer_read_packet(esl_buffer_t *buffer, void *data, char *pe, *p, *e, *head = (char *) buffer->head; esl_size_t datalen = 0; - assert(buffer != NULL); - assert(data != NULL); + esl_assert(buffer != NULL); + esl_assert(data != NULL); e = (head + buffer->used); @@ -268,12 +250,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, { esl_size_t freespace, actual_freespace; - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } - assert(data != NULL); - assert(buffer->data != NULL); + esl_assert(buffer != NULL); + esl_assert(data != NULL); + esl_assert(buffer->data != NULL); if (!datalen) { return buffer->used; @@ -332,11 +311,8 @@ ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, ESL_DECLARE(void) esl_buffer_zero(esl_buffer_t *buffer) { - assert(buffer != NULL); - if (!buffer) { - return; - } - assert(buffer->data != NULL); + esl_assert(buffer != NULL); + esl_assert(buffer->data != NULL); buffer->used = 0; buffer->actually_used = 0;