Data Structures | Macros | Typedefs
rbuffer.h File Reference
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  rbuffer
 

Macros

#define RBUFFER_UNTIL_EMPTY(buf, rptr, rcnt)
 
#define RBUFFER_UNTIL_FULL(buf, wptr, wcnt)
 
#define RBUFFER_EACH(buf, c, i)
 
#define RBUFFER_EACH_REVERSE(buf, c, i)
 

Typedefs

typedef struct rbuffer RBuffer
 
typedef void(* rbuffer_callback) (RBuffer *buf, void *data)
 

Macro Definition Documentation

◆ RBUFFER_EACH

#define RBUFFER_EACH (   buf,
  c,
  i 
)
Value:
for (size_t i = 0; /* NOLINT(readability/braces) */ \
i < buf->size; \
i = buf->size) \
for (char c = 0; /* NOLINT(readability/braces) */ \
i < buf->size ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \
i++)

◆ RBUFFER_EACH_REVERSE

#define RBUFFER_EACH_REVERSE (   buf,
  c,
  i 
)
Value:
for (size_t i = buf->size; /* NOLINT(readability/braces) */ \
i != SIZE_MAX; \
i = SIZE_MAX) \
for (char c = 0; /* NOLINT(readability/braces) */ \
i-- > 0 ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \
)

◆ RBUFFER_UNTIL_EMPTY

#define RBUFFER_UNTIL_EMPTY (   buf,
  rptr,
  rcnt 
)
Value:
for (size_t rcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \
for ( /* NOLINT(readability/braces) */ \
char *rptr = rbuffer_read_ptr(buf, &rcnt); \
buf->size; \
rptr = rbuffer_read_ptr(buf, &rcnt))

◆ RBUFFER_UNTIL_FULL

#define RBUFFER_UNTIL_FULL (   buf,
  wptr,
  wcnt 
)
Value:
for (size_t wcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \
for ( /* NOLINT(readability/braces) */ \
char *wptr = rbuffer_write_ptr(buf, &wcnt); \
rbuffer_space(buf); \
wptr = rbuffer_write_ptr(buf, &wcnt))

Typedef Documentation

◆ RBuffer

typedef struct rbuffer RBuffer

◆ rbuffer_callback

typedef void(* rbuffer_callback) (RBuffer *buf, void *data)

Type of function invoked during certain events:

  • When the RBuffer switches to the full state
  • When the RBuffer switches to the non-full state
i
static void int i
Definition: edit.c:2997
rbuffer_read_ptr
char * rbuffer_read_ptr(RBuffer *buf, size_t *read_count) FUNC_ATTR_NONNULL_ALL
Definition: rbuffer.c:120
buf
char *const buf
Definition: encode.c:235
rbuffer_write_ptr
char * rbuffer_write_ptr(RBuffer *buf, size_t *write_count) FUNC_ATTR_NONNULL_ALL
Definition: rbuffer.c:61
rbuffer_get
char * rbuffer_get(RBuffer *buf, size_t index) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
Definition: rbuffer.c:199