summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2008-08-20 17:59:42 +0000
committerWerner Koch <wk@gnupg.org>2008-08-20 17:59:42 +0000
commit2f818ed3f919a9f8f565b67007b194fa953e7d9b (patch)
tree72827351385a8fb1e13998f9df6864287bec2dcf /src/misc.c
parentee4d4642216dd04c84a360a5dd59c090e095114c (diff)
downloadlibgcrypt-2f818ed3f919a9f8f565b67007b194fa953e7d9b.tar.gz
Replace assert calls by a new gcry_assert at most places.
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/misc.c b/src/misc.c
index 71c60037..cbb59e1d 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1,5 +1,6 @@
/* misc.c
- * Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999, 2001, 2002, 2003, 2007,
+ * 2008 Free Software Foundation, Inc.
*
* This file is part of Libgcrypt.
*
@@ -151,7 +152,7 @@ _gcry_log( int level, const char *fmt, ... )
}
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
+#if defined(JNLIB_GCC_M_FUNCTION) || __STDC_VERSION__ >= 199901L
void
_gcry_bug( const char *file, int line, const char *func )
{
@@ -159,6 +160,14 @@ _gcry_bug( const char *file, int line, const char *func )
("... this is a bug (%s:%d:%s)\n"), file, line, func );
abort(); /* never called, but it makes the compiler happy */
}
+void
+_gcry_assert_failed (const char *expr, const char *file, int line,
+ const char *func)
+{
+ _gcry_log (GCRY_LOG_BUG,
+ ("Assertion `%s' failed (%s:%d:%s)\n"), expr, file, line, func );
+ abort(); /* Never called, but it makes the compiler happy. */
+}
#else
void
_gcry_bug( const char *file, int line )
@@ -167,6 +176,13 @@ _gcry_bug( const char *file, int line )
_("you found a bug ... (%s:%d)\n"), file, line);
abort(); /* never called, but it makes the compiler happy */
}
+void
+_gcry_assert_failed (const char *expr, const char *file, int line)
+{
+ _gcry_log (GCRY_LOG_BUG,
+ ("Assertion `%s' failed (%s:%d)\n"), expr, file, line);
+ abort(); /* Never called, but it makes the compiler happy. */
+}
#endif
void