|
void | try_to_free_memory (void) |
|
void * | try_malloc (size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) |
|
void * | verbose_try_malloc (size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) |
|
void * | xmalloc (size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) FUNC_ATTR_NONNULL_RET |
|
void | xfree (void *ptr) |
|
void * | xcalloc (size_t count, size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE_PROD(1 |
|
| if (!ret) |
|
void * | xrealloc (void *ptr, size_t size) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALLOC_SIZE(2) FUNC_ATTR_NONNULL_RET |
|
void * | xmallocz (size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT |
|
void * | xmemdupz (const void *data, size_t len) FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL |
|
char * | xstrchrnul (const char *str, char c) FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE |
|
void * | xmemscan (const void *addr, char c, size_t size) FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE |
|
void | strchrsub (char *str, char c, char x) FUNC_ATTR_NONNULL_ALL |
|
void | memchrsub (void *data, char c, char x, size_t len) FUNC_ATTR_NONNULL_ALL |
|
size_t | strcnt (const char *str, char c) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE |
|
size_t | memcnt (const void *data, char c, size_t len) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE |
|
char * | xstpcpy (char *restrict dst, const char *restrict src) FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL |
|
char * | xstpncpy (char *restrict dst, const char *restrict src, size_t maxlen) FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL |
|
size_t | xstrlcpy (char *restrict dst, const char *restrict src, size_t dsize) FUNC_ATTR_NONNULL_ALL |
|
size_t | xstrlcat (char *const dst, const char *const src, const size_t dsize) FUNC_ATTR_NONNULL_ALL |
|
char * | xstrdup (const char *str) FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL |
|
char * | xstrdupnul (const char *const str) FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET |
|
void * | xmemrchr (const void *src, uint8_t c, size_t len) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE |
|
char * | xstrndup (const char *str, size_t len) FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL |
|
void * | xmemdup (const void *data, size_t len) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(2) FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL |
|
bool | strequal (const char *a, const char *b) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT |
| Returns true if strings a and b are equal. Arguments may be NULL. More...
|
|
bool | striequal (const char *a, const char *b) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT |
| Case-insensitive strequal . More...
|
|
void | do_outofmem_msg (size_t size) |
|
void | time_to_bytes (time_t time_, uint8_t buf[8]) |
| Writes time_t to "buf[8]". More...
|
|
void | arena_start (Arena *arena, ArenaMem *reuse_blk) |
|
ArenaMem | arena_finish (Arena *arena) |
|
void * | arena_alloc (Arena *arena, size_t size, bool align) |
|
void | arena_mem_free (ArenaMem mem, ArenaMem *reuse_blk) |
|
char * | arena_memdupz (Arena *arena, const char *buf, size_t size) |
|
Finnish the allocations in an arena.
This does not immedately free the memory, but leaves existing allocated objects valid, and returns an opaque ArenaMem handle, which can be used to free the allocations using arena_mem_free
, when the objects allocated from the arena are not needed anymore.
char* xstpcpy |
( |
char *restrict |
dst, |
|
|
const char *restrict |
src |
|
) |
| |
Copies the string pointed to by src (including the terminating NUL character) into the array pointed to by dst.
- Returns
- pointer to the terminating NUL char copied into the dst buffer. This is the only difference with strcpy(), which returns dst.
WARNING: If copying takes place between objects that overlap, the behavior is undefined.
Nvim version of POSIX 2008 stpcpy(3). We do not require POSIX 2008, so implement our own version.
- Parameters
-
char* xstpncpy |
( |
char *restrict |
dst, |
|
|
const char *restrict |
src, |
|
|
size_t |
maxlen |
|
) |
| |
Copies not more than n bytes (bytes that follow a NUL character are not copied) from the array pointed to by src to the array pointed to by dst.
If a NUL character is written to the destination, xstpncpy() returns the address of the first such NUL character. Otherwise, it shall return &dst[maxlen].
WARNING: If copying takes place between objects that overlap, the behavior is undefined.
WARNING: xstpncpy will ALWAYS write maxlen bytes. If src is shorter than maxlen, zeroes will be written to the remaining bytes.
- Parameters
-