|
Graphviz
2.29.20120524.0446
|
00001 /* $Id$ $Revision$ */ 00002 /* vim:set shiftwidth=4 ts=8: */ 00003 00004 /************************************************************************* 00005 * Copyright (c) 2011 AT&T Intellectual Property 00006 * All rights reserved. This program and the accompanying materials 00007 * are made available under the terms of the Eclipse Public License v1.0 00008 * which accompanies this distribution, and is available at 00009 * http://www.eclipse.org/legal/epl-v10.html 00010 * 00011 * Contributors: See CVS logs. Details at http://www.graphviz.org/ 00012 *************************************************************************/ 00013 00014 #ifndef GV_MEMORY_H 00015 #define GV_MEMORY_H 00016 00017 #include <stdlib.h> 00018 #ifdef HAVE_MALLOC_H 00019 #include <malloc.h> 00020 #endif 00021 00022 #ifdef __cplusplus 00023 extern "C" { 00024 #endif 00025 00026 #ifdef DMALLOC 00027 #define NEW(t) (t*)calloc(1,sizeof(t)) 00028 #define N_NEW(n,t) (t*)calloc((n),sizeof(t)) 00029 #define GNEW(t) (t*)malloc(sizeof(t)) 00030 #define N_GNEW(n,t) (t*)malloc((n)*sizeof(t)) 00031 #define ALLOC(size,ptr,type) (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type))) 00032 #define RALLOC(size,ptr,type) ((type*)realloc(ptr,(size)*sizeof(type))) 00033 #define ZALLOC(size,ptr,type,osize) (ptr? (type*)recalloc(ptr,(size)*sizeof(type)):(type*)calloc((size),sizeof(type))) 00034 #else 00035 #define NEW(t) (t*)zmalloc(sizeof(t)) 00036 #define N_NEW(n,t) (t*)zmalloc((n)*sizeof(t)) 00037 #define GNEW(t) (t*)gmalloc(sizeof(t)) 00038 00039 #define N_GNEW(n,t) (t*)gmalloc((n)*sizeof(t)) 00040 #define N_GGNEW(n,t) (t*)malloc((n)*sizeof(t)) 00041 #define ALLOC(size,ptr,type) (ptr? (type*)grealloc(ptr,(size)*sizeof(type)):(type*)gmalloc((size)*sizeof(type))) 00042 #define RALLOC(size,ptr,type) ((type*)grealloc(ptr,(size)*sizeof(type))) 00043 #define ZALLOC(size,ptr,type,osize) (ptr? (type*)zrealloc(ptr,size,sizeof(type),osize):(type*)zmalloc((size)*sizeof(type))) 00044 #endif 00045 #ifdef GVDLL 00046 #define extern __declspec(dllexport) 00047 #else 00048 #ifdef WIN32_DLL 00049 #ifndef GVC_EXPORTS 00050 #define extern __declspec(dllimport) 00051 #endif 00052 #endif 00053 00054 #endif 00055 00056 extern void *zmalloc(size_t); 00057 extern void *zrealloc(void *, size_t, size_t, size_t); 00058 extern void *gmalloc(size_t); 00059 extern void *grealloc(void *, size_t); 00060 #undef extern 00061 00062 #ifdef __cplusplus 00063 } 00064 #endif 00065 00066 #endif
1.7.5