diff options
author | Karl Berry <karl@freefriends.org> | 2008-05-21 01:08:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-05-21 01:08:58 +0000 |
commit | 0ec78c5842c97cb4790129f345d904837dd1fd9c (patch) | |
tree | 20936290ae9060c90dffab6e58548b990228dd61 /Build/source/texk/dvipdfmx/src/mem.h | |
parent | 29da3025cc0e364dc9a60bafce96e7fa110d433a (diff) |
dvipdfmx-20080520 snapshot, after remaking autofiles
git-svn-id: svn://tug.org/texlive/trunk@8263 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfmx/src/mem.h')
-rw-r--r-- | Build/source/texk/dvipdfmx/src/mem.h | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/Build/source/texk/dvipdfmx/src/mem.h b/Build/source/texk/dvipdfmx/src/mem.h index 90e9db7da7a..6380e9e9125 100644 --- a/Build/source/texk/dvipdfmx/src/mem.h +++ b/Build/source/texk/dvipdfmx/src/mem.h @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/mem.h,v 1.4 2007/11/14 03:36:01 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/mem.h,v 1.5 2007/11/17 18:08:58 matthias Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -25,31 +25,42 @@ #ifndef _MEM_H_ #define _MEM_H_ -#undef MEM_DEBUG - #include <stdlib.h> -extern void *new (size_t size, const char *file, const char *function, int line); -extern void *renew (void *p, size_t size, const char *file, const char *function, int line); -extern void release (void *mem, const char *file, const char *function, int line); +extern void *new (size_t size); +extern void *renew (void *p, size_t size); extern void mem_debug_init(void); extern void mem_debug_check(void); +#undef MEM_DEBUG + #ifdef MEM_DEBUG -#include <stdio.h> -extern long int mem_event; -#define NEW(n,type) (type *)(new (((size_t) (n))*sizeof(type),__FILE__,__FUNCTION__,__LINE__)) -#define RENEW(p,n,type) (type *)(renew ((p),(n)*sizeof(type),__FILE__,__FUNCTION__,__LINE__)) -#define RELEASE(p) release ((p),__FILE__,__FUNCTION__,__LINE__) -#define MEM_START {mem_debug_init();fprintf (stderr, "Entered %s\n", __FUNCTION__);} -#define MEM_END fprintf (stderr, "Leaving %s\n", __FUNCTION__); -#else /* MEM_DEBUG */ -#define MEM_START -#define MEM_END -#define NEW(n,type) (type *)(new (((size_t) (n))*sizeof(type),NULL,NULL,0)) -#define RENEW(p,n,type) (type *)(renew ((p),(n)*sizeof(type),NULL,NULL,0)) -#define RELEASE(p) release ((p),NULL,NULL,0) + +extern void *mem_add (void *ptr, + const char *file, const char *function, int line); +extern void *mem_remove (void *ptr, + const char *file, const char *function, int line); +#define MEM_ADD(p) mem_add(p, __FILE__, __FUNCTION__, __LINE__) +#define MEM_REMOVE(p) mem_remove(p, __FILE__, __FUNCTION__, __LINE__) + +#else /* ! MEM_DEBUG */ + +extern void *mem_add (void *ptr); +extern void *mem_remove (void *ptr); +#define MEM_ADD(p) mem_add(p) +#define MEM_REMOVE(p) mem_remove(p) + #endif /* MEM_DEBUG */ + +#define NEW(n,type) (type *) MEM_ADD(new(((size_t)(n))*sizeof(type))) +#define RENEW(p,n,type) (type *) MEM_ADD(renew(MEM_REMOVE(p),(n)*sizeof(type))) +#define RELEASE(p) free(MEM_REMOVE(p)) + +/* wrappers for functions from kpathsea */ +#define kpse_path_search(x,y,z) (char *) MEM_ADD(kpse_path_search(x,y,z)) +#define kpse_find_file(x,y,z) (char *) MEM_ADD(kpse_find_file(x,y,z)) +#define kpse_find_glyph(x,y,z,w) (char *) MEM_ADD(kpse_find_glyph(x,y,z,w)) + #endif /* _MEM_H_ */ |