Wed, 09 May 2018 15:04:15 +0200
adds ucx_buffer_to_sstr() macro
src/ucx/buffer.h | file | annotate | diff | comparison | revisions |
1.1 --- a/src/ucx/buffer.h Thu May 03 10:44:33 2018 +0200 1.2 +++ b/src/ucx/buffer.h Wed May 09 15:04:15 2018 +0200 1.3 @@ -165,8 +165,8 @@ 1.4 * 1.5 * @param buffer the buffer to be cleared 1.6 */ 1.7 -#define ucx_buffer_clear(buffer) memset(buffer->space, 0, buffer->size); \ 1.8 - buffer->size = 0; buffer->pos = 0; 1.9 +#define ucx_buffer_clear(buffer) memset((buffer)->space, 0, (buffer)->size); \ 1.10 + (buffer)->size = 0; (buffer)->pos = 0; 1.11 1.12 /** 1.13 * Tests, if the buffer position has exceeded the buffer capacity. 1.14 @@ -262,6 +262,14 @@ 1.15 */ 1.16 size_t ucx_buffer_puts(UcxBuffer *buffer, char *str); 1.17 1.18 +/** 1.19 + * Returns the complete buffer content as sstr_t. 1.20 + * @param buffer the buffer 1.21 + * @return the result of <code>sstrn()</code> with the buffer space and size 1.22 + * as arguments 1.23 + */ 1.24 +#define ucx_buffer_to_sstr(buffer) sstrn((buffer)->space, (buffer)->size) 1.25 + 1.26 #ifdef __cplusplus 1.27 } 1.28 #endif