From dd192cc2ac301972f6761f5d6bd3a4c6a46736bf Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sat, 28 Jan 2006 18:56:51 +0000 Subject: Add C RRD create tool. See #50 --- common/compat.c | 13 +++++++++++++ common/compat.h | 4 ++++ 2 files changed, 17 insertions(+) (limited to 'common') diff --git a/common/compat.c b/common/compat.c index 0c6c833..247560e 100644 --- a/common/compat.c +++ b/common/compat.c @@ -230,3 +230,16 @@ atexitv(voidfunc func, void* data) } #endif /* HAVE_ATEXITV */ + +#ifndef HAVE_XCALLOC + +void* +xcalloc(size_t size) +{ + register void* value = calloc(1, size); + if(value == NULL) + errx("out of memory"); + return value; +} + +#endif /* HAVE_XCALLOC */ diff --git a/common/compat.h b/common/compat.h index 7ef2f50..12ffad6 100644 --- a/common/compat.h +++ b/common/compat.h @@ -73,4 +73,8 @@ int strtob(const char* str); void atexitv(void (*func)(void*), void* data); #endif +#ifndef HAVE_XCALLOC +void* xcalloc(size_t size); +#endif + #endif /* __COMPAT_H__ */ -- cgit v1.2.3