Removed extra semicolons from SILC_ASSERT and SILC_VERIFY macros
[silc.git] / lib / silcutil / silclog.h
index 60949270eb1b8587f51f251a326ff0a36ad65a44..6b50553e685d3008f380423c25ecec429c8f7653 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2006 Pekka Riikonen
+  Copyright (C) 1997 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -67,6 +67,8 @@ typedef enum {
  *    The `message' parameter points to a null-terminated buffer containing
  *    the received message, while `context' is the caller-specified context.
  *    The message must not be modified or freed by the callback function.
+ *    If the function returns TRUE, SilcLog will assume the message was
+ *    handled and won't run its default handler.
  *
  * SEE ALSO
  *    silc_log_set_callback
@@ -301,12 +303,38 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
  * SOURCE
  */
 #if defined(SILC_DEBUG)
-#define SILC_ASSERT(expr) assert((expr));
+#define SILC_ASSERT(expr) assert((expr))
 #else
 #define SILC_ASSERT(expr) do { } while(0)
 #endif /* SILC_DEBUG */
 /***/
 
+/****d* silcutil/SilcLogAPI/SILC_VERIFY
+ *
+ * NAME
+ *
+ *    #define SILC_VERIFY(experssion)
+ *
+ * DESCRIPTION
+ *
+ *    Verification macro that prints error message to stderr and calls
+ *    abort() if the `expression' is false (ie. compares equal to zero)
+ *    on debug builds (SILC_DEBUG defined), and prints error message to
+ *    stderr on release builds (SILC_DEBUG undefined) but does not abort().
+ *    This macro is always compiled even if debugging (SILC_DEBUG) is not
+ *    defined.
+ *
+ * SOURCE
+ */
+#if defined(SILC_DEBUG)
+#define SILC_VERIFY(expr) assert((expr))
+#else
+#define SILC_VERIFY(expr)                                              \
+  if (!(expr))                                                         \
+    SILC_LOG_ERROR(("SILC_VERIFY %s:%d", __FUNCTION__, __LINE__))
+#endif /* SILC_DEBUG */
+/***/
+
 /* Prototypes */
 
 /****f* silcutil/SilcLogAPI/silc_log_set_file