NAME
kasprintf
,
kcalloc
, kmalloc
,
krealloc
, kreallocarray
,
kstrdup
, kvasprintf
—
memory allocation functions for
kcgi
LIBRARY
library “libkcgi”
SYNOPSIS
#include
<sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
int
kasprintf
(char
**p, const char
*fmt, ...);
void *
kcalloc
(size_t
nm, size_t sz);
void *
kmalloc
(size_t
sz);
void *
krealloc
(void
*p, size_t sz);
void *
kreallocarray
(void
*p, size_t nm,
size_t sz);
char *
kstrdup
(const
char *cp);
int
kvasprintf
(char
**p, const char
*fmt, va_list
ap);
DESCRIPTION
These functions wrap around corresponding libc versions except that on allocation failure, they print a warning message to standard error output and call exit(3).
Calling
kcalloc
(),
kmalloc
(),
krealloc
(),
or
kreallocarray
()
with sz or nm equal to zero, or
passing NULL
to
kstrdup
(),
additionally prints a warning message to the standard error output and
produces non-portable results.
SEE ALSO
AUTHORS
These functions were written by Kristaps Dzonsons <kristaps@bsd.lv>.