File: assert.h

package info (click to toggle)
yaku-ns 0.2-4
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 432 kB
  • sloc: ansic: 5,176; sh: 81; makefile: 64
file content (33 lines) | stat: -rw-r--r-- 592 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
/* assert.h
 *
 * just the assert that uses the DNS server logging
 *
 * Copyright (C) 2000-2001 by Salvatore Sanfilippo
 * <antirez@invece.org>
 *
 * This code is under the GPL license version 2
 * See the COPYING file for more information
 */

#ifndef ENS_ASSERT_H
#define ENS_ASSERT_H

#ifdef NDEBUG

#define assert(expr)	do { } while(0)

#else /* !NDEBUG */

#define assert(x) \
do { \
	if ((x) == 0) { \
		ylog(VERB_FORCE, \
			"assert failed: %s is false in %s at line %d\n", \
			#x, __FILE__, __LINE__); \
		abort(); \
	} \
} while(0)

#endif /* !NDEBUG */

#endif /* ENS_ASSERT_H */