File: debug.h

package info (click to toggle)
netcdf 1%3A4.1.3-7.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 46,040 kB
  • ctags: 25,265
  • sloc: ansic: 169,389; fortran: 17,742; sh: 13,203; cpp: 10,960; f90: 7,903; yacc: 2,832; xml: 2,129; makefile: 2,034; lex: 1,210
file content (43 lines) | stat: -rwxr-xr-x 1,299 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef NCGEN_DEBUG_H
#define NCGEN_DEBUG_H

/*#define F*/

/*********************************************************************
 *   Copyright 1993, UCAR/Unidata
 *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
 *   $Header: /upc/share/CVS/netcdf-3/ncgen/debug.h,v 1.2 2010/03/31 18:18:34 dmh Exp $
 *********************************************************************/

#include <stdarg.h>
#include <assert.h>
#include "generr.h"
#include "bytebuffer.h"

extern int ncgdebug;
extern int debug;

extern void fdebug(const char *fmt, ...);

#define PANIC(msg) assert(panic(msg))
#define PANIC1(msg,arg) assert(panic(msg,arg))
#define PANIC2(msg,arg1,arg2) assert(panic(msg,arg1,arg2))
#define ASSERT(expr) {if(!(expr)) {panic("assertion failure: %s",#expr);}}
extern int panic(const char* fmt, ...);

/*
Provide wrapped versions of calloc and malloc.
The wrapped version panics if memory is exhausted.
*/

#define ecalloc(x,y) chkcalloc(x,y)
#define emalloc(x)   chkmalloc(x)
#define erealloc(p,x)   chkrealloc(p,x)
#define efree(x) chkfree(x)
extern void* chkcalloc(size_t, size_t);
extern void* chkmalloc(size_t);
extern void* chkrealloc(void*,size_t);
extern void  chkfree(void*);
#define MEMCHECK(var,throw) {if((var)==NULL) return (throw);}

#endif /*NCGEN_DEBUG_H*/