xref: /netbsd-src/external/bsd/openldap/dist/libraries/liblber/assert.c (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: assert.c,v 1.3 2021/08/14 16:14:55 christos Exp $	*/
2 
3 /* $OpenLDAP$ */
4 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5  *
6  * Copyright 1998-2021 The OpenLDAP Foundation.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted only as authorized by the OpenLDAP
11  * Public License.
12  *
13  * A copy of this license is available in the file LICENSE in the
14  * top-level directory of the distribution or, alternatively, at
15  * <http://www.OpenLDAP.org/license.html>.
16  */
17 
18 #include <sys/cdefs.h>
19 __RCSID("$NetBSD: assert.c,v 1.3 2021/08/14 16:14:55 christos Exp $");
20 
21 #include "portable.h"
22 
23 #ifdef LDAP_NEED_ASSERT
24 
25 #include <stdio.h>
26 
27 /*
28  * helper for our private assert() macro
29  *
30  * note: if assert() doesn't exist, like abort() or raise() won't either.
31  * could use kill() but that might be problematic.  I'll just ignore this
32  * issue for now.
33  */
34 
35 void
ber_pvt_assert(const char * file,int line,const char * test)36 ber_pvt_assert( const char *file, int line, const char *test )
37 {
38 	fprintf(stderr,
39 		_("Assertion failed: %s, file %s, line %d\n"),
40 			test, file, line);
41 
42 	abort();
43 }
44 
45 #endif
46