/****************************************************************************1* Copyright (c) 1998 Free Software Foundation, Inc. *2* *3* Permission is hereby granted, free of charge, to any person obtaining a *4* copy of this software and associated documentation files (the *5* "Software"), to deal in the Software without restriction, including *6* without limitation the rights to use, copy, modify, merge, publish, *7* distribute, distribute with modifications, sublicense, and/or sell *8* copies of the Software, and to permit persons to whom the Software is *9* furnished to do so, subject to the following conditions: *10* *11* The above copyright notice and this permission notice shall be included *12* in all copies or substantial portions of the Software. *13* *14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *15* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *17* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *20* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *21* *22* Except as contained in this notice, the name(s) of the above copyright *23* holders shall not be used in advertising or otherwise to promote the *24* sale, use or other dealings in this Software without prior written *25* authorization. *26****************************************************************************/2728/****************************************************************************29* Author: Thomas E. Dickey <[email protected]> 1996,1997 *30****************************************************************************/31/* $Id$ */3233#ifndef NC_ALLOC_included34#define NC_ALLOC_included 13536#if HAVE_LIBDMALLOC37#include <dmalloc.h> /* Gray Watson's library */38#else39#undef HAVE_LIBDMALLOC40#define HAVE_LIBDMALLOC 041#endif4243#if HAVE_LIBDBMALLOC44#include <dbmalloc.h> /* Conor Cahill's library */45#else46#undef HAVE_LIBDBMALLOC47#define HAVE_LIBDBMALLOC 048#endif4950#ifndef NO_LEAKS51#define NO_LEAKS 052#endif5354#if HAVE_LIBDBMALLOC || HAVE_LIBDMALLOC || NO_LEAKS55#define HAVE_NC_FREEALL 156struct termtype;57extern void _nc_free_and_exit(int) GCC_NORETURN;58extern void _nc_free_tparm(void);59extern void _nc_leaks_dump_entry(void);60#define ExitProgram(code) _nc_free_and_exit(code)61#endif6263#ifndef HAVE_NC_FREEALL64#define HAVE_NC_FREEALL 065#endif6667#ifndef ExitProgram68#define ExitProgram(code) return code69#endif7071/* doalloc.c */72extern void *_nc_doalloc(void *, size_t);73#if !HAVE_STRDUP74/* #define strdup _nc_strdup */75extern char *_nc_strdup(const char *);76#endif7778#define typeMalloc(type,elts) (type *)malloc((elts)*sizeof(type))79#define typeCalloc(type,elts) (type *)calloc((elts),sizeof(type))80#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (elts)*sizeof(type))8182#endif /* NC_ALLOC_included */838485