Skip to content

Commit

Permalink
added ring_buffer_debug()
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Dec 9, 2016
1 parent 40ab6c4 commit ff016d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/util/ring_buffer.c
Expand Up @@ -520,3 +520,14 @@ int fr_ring_buffer_start(fr_ring_buffer_t *rb, uint8_t **p_start, size_t *p_size

return 0;
}

/** Print debug information about the ring buffer
*
* @param[in] rb the ring buffer
* @param[in] fp the FILE where the messages are printed.
*/
void fr_ring_buffer_debug(fr_ring_buffer_t *rb, FILE *fp)
{
fprintf(fp, "Buffer %p, write_offset %zd, data_start %zd, data_end %zd\n",
rb->buffer, rb->write_offset, rb->data_start, rb->data_end);
}
2 changes: 2 additions & 0 deletions src/util/ring_buffer.h
Expand Up @@ -52,6 +52,8 @@ int fr_ring_buffer_close(fr_ring_buffer_t *rb) CC_HINT(nonnull);
size_t fr_ring_buffer_size(fr_ring_buffer_t *rb) CC_HINT(nonnull);
size_t fr_ring_buffer_used(fr_ring_buffer_t *rb) CC_HINT(nonnull);

void fr_ring_buffer_debug(fr_ring_buffer_t *rb, FILE *fp) CC_HINT(nonnull);

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit ff016d4

Please sign in to comment.