KMALLOC(3) Library Functions Manual KMALLOC(3)

NAME

kasprintf, kcalloc, kmalloc, krealloc, kreallocarray, kstrdupmemory 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);

DESCRIPTION

These functions are wrappers around the usual libc versions, except that on allocation failure, they print a warning message to the standard error output and call exit(3).
Calling kcalloc(), kmalloc(), krealloc(), or kreallocarray() with sz or nm equal to zero prints a warning message to the standard error output and produces non-portable results.

SEE ALSO

kcgi(3)

AUTHORS

These functions were written by Kristaps Dzonsons <kristaps@bsd.lv>.
December 30, 2017 OpenBSD 6.2