Author: colin
Date: 2008-03-07 17:36:17 +0100 (Fri, 07 Mar 2008)
New Revision: 987

Modified:
   trunk/Mix/Src/Makefile.in
   trunk/Mix/Src/buffers.c
   trunk/Mix/Src/pgp.h
   trunk/Mix/Src/pgpdb.c
Log:
Fix use of NDEBUG and DEBUG


Modified: trunk/Mix/Src/Makefile.in
===================================================================
--- trunk/Mix/Src/Makefile.in   2008-03-07 16:27:20 UTC (rev 986)
+++ trunk/Mix/Src/Makefile.in   2008-03-07 16:36:17 UTC (rev 987)
@@ -13,9 +13,12 @@
 LIBS = %LIBS
 LDFLAGS = %LDFLAGS
 
-OPT = -g -Wall
+# Set compiler options
+# Note: Define NDEBUG to disable "assert" when not using DEBUG
+
+OPT = -g -Wall -DNDEBUG
 # OPT = -g -pg -Wall -DDEBUG
-# OPT = -O2 -Wall
+# OPT = -O2 -Wall -DNDEBUG
 
 CFLAGS = $(INC) $(DEF) $(OPT)
 CC = gcc

Modified: trunk/Mix/Src/buffers.c
===================================================================
--- trunk/Mix/Src/buffers.c     2008-03-07 16:27:20 UTC (rev 986)
+++ trunk/Mix/Src/buffers.c     2008-03-07 16:36:17 UTC (rev 987)
@@ -40,7 +40,10 @@
   b->size = space;
 }
 
-#undef buf_new /* DEBUG */
+#ifdef DEBUG
+#undef buf_new
+#endif /* DEBUG */
+
 BUFFER *buf_new(void)
 {
   BUFFER *b;
@@ -56,7 +59,6 @@
   return (b);
 }
 
-#ifdef DEBUG
 static void sanity_check(BUFFER *b)
 {
   assert(b != NULL);
@@ -65,9 +67,6 @@
   assert(b->length >= 0 && b->length < b->size);
   assert(b->ptr >= 0 && b->ptr <= b->length);
 }
-#else /* not DEBUG */
-#define sanity_check(arg)
-#endif /* else not DEBUG */
 
 int buf_reset(BUFFER *buffer)
 {

Modified: trunk/Mix/Src/pgp.h
===================================================================
--- trunk/Mix/Src/pgp.h 2008-03-07 16:27:20 UTC (rev 986)
+++ trunk/Mix/Src/pgp.h 2008-03-07 16:36:17 UTC (rev 987)
@@ -174,7 +174,7 @@
   int type; /* undefined, public, private */
   char filename[LINELEN];
   BUFFER *encryptkey;
-#ifndef NDEBUG
+#ifdef DEBUG
   int writer;
 #endif
 } KEYRING;

Modified: trunk/Mix/Src/pgpdb.c
===================================================================
--- trunk/Mix/Src/pgpdb.c       2008-03-07 16:27:20 UTC (rev 986)
+++ trunk/Mix/Src/pgpdb.c       2008-03-07 16:36:17 UTC (rev 987)
@@ -73,7 +73,7 @@
 
   assert(! ((writer) && (type == PGP_TYPE_UNDEFINED)));
   keydb = pgpdb_new(keyring, -1, encryptkey, type);
-#ifndef NDEBUG
+#ifdef DEBUG
   keydb->writer = writer;
 #endif
   if (writer)
@@ -122,7 +122,7 @@
 
   if (keydb->modified) {
     FILE *f;
-#ifndef ndebug
+#ifdef DEBUG
     assert(keydb->writer);
 #endif
     if (keydb->encryptkey && keydb->encryptkey->length)
@@ -226,7 +226,7 @@
 int pgpdb_append(KEYRING *keydb, BUFFER *p)
 {
   assert(keydb->lock);
-#ifndef ndebug
+#ifdef DEBUG
   assert(keydb->writer);
 #endif
   buf_cat(keydb->db, p);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mixmaster-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixmaster-devel

Reply via email to