KMALLOC(3) Library Functions Manual KMALLOC(3)

NAME

kasprintf, kcalloc, kmalloc, krealloc, kreallocarray, kstrdupmemory functions for kcgi

LIBRARY

library “libkcgi”

SYNOPSIS

#include <sys/types.h>
#include <stdarg.h>
#include <stddef.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

The kasprintf, kcalloc, kmalloc, krealloc, kreallocarray, and kstrdup functions are wrappers around the usual libc versions of these functions, only these will exit(3) on allocation failure.
Note that calling any of these functions with an allocation length of zero produces non-portable results.

SEE ALSO

kcgi(3)

AUTHORS

The kasprintf, kcalloc, kmalloc, krealloc, kreallocarray, and kstrdup functions were written by Kristaps Dzonsons <kristaps@bsd.lv>.
September 22, 2017 OpenBSD 5.8