src/ucx/buffer.h

changeset 289
a5eabd407774
parent 259
2f5dea574a75
child 290
d5d6ab809ad3
equal deleted inserted replaced
287:98da78a1e69a 289:a5eabd407774
163 * 163 *
164 * The data is deleted by a zeroing it with call to <code>memset()</code>. 164 * The data is deleted by a zeroing it with call to <code>memset()</code>.
165 * 165 *
166 * @param buffer the buffer to be cleared 166 * @param buffer the buffer to be cleared
167 */ 167 */
168 #define ucx_buffer_clear(buffer) memset(buffer->space, 0, buffer->size); \ 168 #define ucx_buffer_clear(buffer) memset((buffer)->space, 0, (buffer)->size); \
169 buffer->size = 0; buffer->pos = 0; 169 (buffer)->size = 0; (buffer)->pos = 0;
170 170
171 /** 171 /**
172 * Tests, if the buffer position has exceeded the buffer capacity. 172 * Tests, if the buffer position has exceeded the buffer capacity.
173 * 173 *
174 * @param buffer the buffer to test 174 * @param buffer the buffer to test
260 * @param str the string 260 * @param str the string
261 * @return the number of bytes written 261 * @return the number of bytes written
262 */ 262 */
263 size_t ucx_buffer_puts(UcxBuffer *buffer, char *str); 263 size_t ucx_buffer_puts(UcxBuffer *buffer, char *str);
264 264
265 /**
266 * Returns the complete buffer content as sstr_t.
267 * @param buffer the buffer
268 * @return the result of <code>sstrn()</code> with the buffer space and size
269 * as arguments
270 */
271 #define ucx_buffer_to_sstr(buffer) sstrn((buffer)->space, (buffer)->size)
272
265 #ifdef __cplusplus 273 #ifdef __cplusplus
266 } 274 }
267 #endif 275 #endif
268 276
269 #endif /* UCX_BUFFER_H */ 277 #endif /* UCX_BUFFER_H */

mercurial