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

#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++)
char *const buf
Definition: encode.c:235
int i
Definition: typval.c:868
char * rbuffer_get(RBuffer *buf, size_t index) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
Definition: rbuffer.c:199
#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; \
)
for(size_t i=1;i< ARRAY_SIZE(argv);i++)
Definition: typval.c:1215
char *const buf
Definition: encode.c:235
int i
Definition: typval.c:868
char * rbuffer_get(RBuffer *buf, size_t index) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
Definition: rbuffer.c:199
#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))
char * rbuffer_read_ptr(RBuffer *buf, size_t *read_count) FUNC_ATTR_NONNULL_ALL
Definition: rbuffer.c:120
char *const buf
Definition: encode.c:235
#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); \
wptr = rbuffer_write_ptr(buf, &wcnt))
size_t rbuffer_space(RBuffer *buf) FUNC_ATTR_NONNULL_ALL
Definition: rbuffer.c:50
char *const buf
Definition: encode.c:235
char * rbuffer_write_ptr(RBuffer *buf, size_t *write_count) FUNC_ATTR_NONNULL_ALL
Definition: rbuffer.c:61

Typedef Documentation

typedef struct rbuffer RBuffer
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