#pragma once #include "allocator.h" #ifdef LIBSTR_ASSERT_ARGS #include "stdlib.h" #define LIBSTR_ABORT_ON_ARGS(cond) do { if (cond) abort(); } while (0) #else #define LIBSTR_ABORT_ON_ARGS(cond) #endif #ifdef LIBSTR_ASSERT_ALLOC #include "stdlib.h" #define LIBSTR_ABORT_ON_ALLOC(cond) do { if (cond) abort(); } while (0) #else #define LIBSTR_ABORT_ON_ALLOC(cond) #endif char * __attribute__((format(printf, 3, 4))) str_fmt(const struct allocator *allocator, int *rc, const char *fmstr, ...); char * __attribute__((format(printf, 4, 5))) str_fmt_realloc(const struct allocator *allocator, int *rc, void *alloc, const char *fmtstr, ...); char *str_dup(const struct allocator *allocator, int *rc, const char *str); char *str_dup_realloc(const struct allocator *allocator, int *rc, void *alloc, const char *str); char *str_ndup(const struct allocator *allocator, int *rc, const char *str, size_t n); char *str_ndup_realloc(const struct allocator *allocator, int *rc, void *alloc, const char *str, size_t n); char *str_app(const struct allocator *allocator, int *rc, char *str, const char *app);