12 #ifndef __USEFUL_BUF_H__    13 #define __USEFUL_BUF_H__    26 #define NULL_USEFUL_BUF_C  NULLUsefulBufC    28 #define NULL_USEFUL_BUF    NULLUsefulBuf    31 static inline int useful_buf_c_is_null(
struct useful_buf_c in)
    37 static inline int useful_buf_is_null(
struct useful_buf in)
    43 static inline int useful_buf_c_is_empty(
struct useful_buf_c in)
    48 static inline int useful_buf_is_empty(
struct useful_buf in)
    54 static inline int useful_buf_is_null_or_empty(
struct useful_buf in)
    60 static inline int useful_buf_c_is_null_or_empty(
struct useful_buf_c in)
    71 #define USEFUL_BUF_FROM_SZ_LITERAL UsefulBuf_FROM_SZ_LITERAL    73 #define USEFUL_BUF_FROM_BYTE_ARRAY_LITERAL  UsefulBuf_FROM_BYTE_ARRAY_LITERAL    75 #define USEFUL_BUF_MAKE_STACK_UB UsefulBuf_MAKE_STACK_UB    77 #define USEFUL_BUF_FROM_BYTE_ARRAY UsefulBuf_FROM_BYTE_ARRAY    80 static inline struct useful_buf_c useful_buf_from_sz(const char *string)
   129 static inline int useful_buf_compare(
const struct useful_buf_c buf1,
   136 useful_buf_find_bytes(
const struct useful_buf_c bytes_to_search,
 int UsefulBuf_Compare(const UsefulBufC UB1, const UsefulBufC UB2)
Compare two UsefulBufCs. 
static UsefulBufC UsefulBuf_Copy(UsefulBuf Dest, const UsefulBufC Src)
Copy one UsefulBuf into another. 
static int UsefulBuf_IsEmpty(UsefulBuf UB)
Check if a UsefulBuf is empty or not. 
static UsefulBufC UsefulBuf_Set(UsefulBuf pDest, uint8_t value)
Set all bytes in a UsefulBuf to a value, for example 0. 
size_t UsefulBuf_FindBytes(UsefulBufC BytesToSearch, UsefulBufC BytesToFind)
Find one UsefulBuf in another. 
The non-const UsefulBuf typically used for some allocated memory that is to be filled in...
static UsefulBuf UsefulBuf_Unconst(const UsefulBufC UBC)
Convert a const UsefulBufC to a non-const UsefulBuf. 
static int UsefulBuf_IsNULLOrEmpty(UsefulBuf UB)
Check if a UsefulBuf is NULL or empty. 
UsefulBufC and UsefulBuf are simple data structures to hold a pointer and length for a binary data...
static int UsefulBuf_IsNULLOrEmptyC(UsefulBufC UB)
Check if a UsefulBufC is NULL or empty. 
The goal of this code is to make buffer and pointer manipulation easier and safer when working with b...
static int UsefulBuf_IsEmptyC(UsefulBufC UB)
Check if a UsefulBufC is empty or not. 
static UsefulBufC UsefulBuf_FromSZ(const char *szString)
Convert a NULL terminated string to a UsefulBufC. 
static UsefulBufC UsefulBuf_Head(UsefulBufC UB, size_t uAmount)
Returns a truncation of a UsefulBufC. 
static int UsefulBuf_IsNULLC(UsefulBufC UB)
Check if a UsefulBufC is NULL or not. 
static UsefulBufC UsefulBuf_CopyPtr(UsefulBuf Dest, const void *ptr, size_t len)
Copy a pointer into a UsefulBuf. 
static UsefulBufC UsefulBuf_Tail(UsefulBufC UB, size_t uAmount)
Returns bytes from the end of a UsefulBufC. 
static int UsefulBuf_IsNULL(UsefulBuf UB)
Check if a UsefulBuf is NULL or not. 
UsefulBufC UsefulBuf_CopyOffset(UsefulBuf Dest, size_t uOffset, const UsefulBufC Src)
Copy one UsefulBuf into another at an offset.