Mercurial > hg > nnchat
view th_util.h @ 100:ed4067c10a8a
Remove useless buffer usage from error reporting function.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 17 Nov 2009 23:09:10 +0200 |
parents | 0313fabd8049 |
children | 4ec36204d34e |
line wrap: on
line source
/* * Generic utility-functions, macros and defaults * Programmed and designed by Matti 'ccr' Hamalainen * (C) Copyright 2002-2009 Tecnic Software productions (TNSP) * * Please read file 'COPYING' for information on license and distribution. */ #ifndef _TH_UTIL_H #define _TH_UTIL_H #ifdef __cplusplus extern "C" { #endif #include "th_types.h" #include <stdarg.h> #include <stdlib.h> #ifndef HAVE_NO_ASSERT #include <assert.h> #endif #ifdef HAVE_STRING_H #include <string.h> #define HAVE_MEMSET 1 #else #ifdef HAVE_STRINGS_H #include <strings.h> #endif #endif #ifdef HAVE_MEMORY_H #include <memory.h> #endif #ifdef TH_NO_DEFAULTS #define TH_PROG_AUTHOR NULL #define TH_PROG_LICENSE NULL #else #define TH_PROG_AUTHOR "By Matti 'ccr' Hämäläinen (C) Copyright 2009 TNSP" #define TH_PROG_LICENSE "This software is licensed under GNU GPL version 2" #endif /* Replacement for assert() */ #ifdef HAVE_NO_ASSERT # ifdef NDEBUG # define assert(NEXPR) /* stub */ # else # define assert(NEXPR) do { if (!(NEXPR)) { fprintf(stderr, "[%s:%d] assert(" # NEXPR ") failed!\n", __FILE__, __LINE__); abort(); } } while (0) # endif #endif /* Global variables */ extern int th_verbosityLevel; extern char *th_prog_name, *th_prog_fullname, *th_prog_version, *th_prog_author, *th_prog_license; /* Functions */ void th_init(char *progName, char *progFullName, char *progVersion, char *progAuthor, char *progLicense); void THERR(const char *, ...); void THMSG(int, const char *, ...); void THPRINT(int, const char *, ...); void THERR_V(const char *, va_list); void THMSG_V(int, const char *, va_list); void THPRINT_V(int, const char *, va_list); void *th_malloc(size_t); void *th_calloc(size_t, size_t); void *th_realloc(void *, size_t); void th_free(void *); #ifdef HAVE_MEMSET #define th_memset memset #else void *th_memset(void *, int, size_t); #endif #ifdef __cplusplus } #endif #endif /* _TH_UTIL_H */