rbuffer.c 730 B

1234567891011121314151617181920212223242526272829303132
  1. // This is an open source non-commercial project. Dear PVS-Studio, please check
  2. // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
  3. #include "nvim/rbuffer.h"
  4. #include "rbuffer.h"
  5. void ut_rbuffer_each_read_chunk(RBuffer *buf, each_ptr_cb cb)
  6. {
  7. RBUFFER_UNTIL_EMPTY(buf, rptr, rcnt) {
  8. cb(rptr, rcnt);
  9. rbuffer_consumed(buf, rcnt);
  10. }
  11. }
  12. void ut_rbuffer_each_write_chunk(RBuffer *buf, each_ptr_cb cb)
  13. {
  14. RBUFFER_UNTIL_FULL(buf, wptr, wcnt) {
  15. cb(wptr, wcnt);
  16. rbuffer_produced(buf, wcnt);
  17. }
  18. }
  19. void ut_rbuffer_each(RBuffer *buf, each_cb cb)
  20. {
  21. RBUFFER_EACH(buf, c, i) cb(c, i);
  22. }
  23. void ut_rbuffer_each_reverse(RBuffer *buf, each_cb cb)
  24. {
  25. RBUFFER_EACH_REVERSE(buf, c, i) cb(c, i);
  26. }