SF.net SVN: mahogany: [7189] trunk/M/lib/dspam/src

[email protected]
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
Revision: 7189
          http://svn.sourceforge.net/mahogany/?rev=7189&view=rev
Author:   vadz
Date:     2006-12-25 11:07:48 -0800 (Mon, 25 Dec 2006)

Log Message:
-----------
added UNUSED() macro to simultaneously avoid warnings about unused parameters in MSVC and code without effect in gcc

Modified Paths:
--------------
    trunk/M/lib/dspam/src/config.h
    trunk/M/lib/dspam/src/error.h
    trunk/M/lib/dspam/src/hash_drv.c
    trunk/M/lib/dspam/src/libdspam.c
    trunk/M/lib/dspam/src/pref.c
    trunk/M/lib/dspam/src/util.c

Modified: trunk/M/lib/dspam/src/config.h
===================================================================
--- trunk/M/lib/dspam/src/config.h	2006-12-25 18:39:58 UTC (rev 7188)
+++ trunk/M/lib/dspam/src/config.h	2006-12-25 19:07:48 UTC (rev 7189)
@@ -27,6 +27,11 @@
 #include <auto-config.h>
 #endif
 
+#ifndef UNUSED
+/* if UNUSED macro is not defined in auto-config.h, remove it completely */
+#define UNUSED(param)
+#endif
+
 #include <limits.h>
 #ifndef _WIN32
 #include <sys/param.h>

Modified: trunk/M/lib/dspam/src/error.h
===================================================================
--- trunk/M/lib/dspam/src/error.h	2006-12-25 18:39:58 UTC (rev 7188)
+++ trunk/M/lib/dspam/src/error.h	2006-12-25 19:07:48 UTC (rev 7189)
@@ -48,7 +48,7 @@
 #ifdef HAVE_ISO_VARARGS
 #define LOGDEBUG( ... );
 #else
-inline void LOGDEBUG (const char *err, ...) { }
+inline void LOGDEBUG (const char *err, ...) { UNUSED(err); }
 #endif
 #else
 void LOGDEBUG (const char *err, ... );
@@ -58,10 +58,10 @@
 #ifdef HAVE_ISO_VARARGS
 #define LOG ( ... );
 #else
-inline void LOG (int priority, const char *err, ... ) { priority; err; }
+inline void LOG (int prio, const char *err, ... ) { UNUSED(prio); UNUSED(err); }
 #endif
 #else
-void LOG (int priority, const char *err, ... );
+void LOG (int prio, const char *err, ... );
 #endif
 
 char *format_date_r (char *buf);

Modified: trunk/M/lib/dspam/src/hash_drv.c
===================================================================
--- trunk/M/lib/dspam/src/hash_drv.c	2006-12-25 18:39:58 UTC (rev 7188)
+++ trunk/M/lib/dspam/src/hash_drv.c	2006-12-25 19:07:48 UTC (rev 7189)
@@ -264,7 +264,7 @@
     }
   }
 #else
-  DTX; /* unused parameter */
+  UNUSED(DTX);
 #endif
 
   return 0;
@@ -834,7 +834,7 @@
 
 void *_ds_connect (DSPAM_CTX *CTX)
 {
-  CTX; /* unused parameter */
+  UNUSED(CTX);
   return NULL;
 }
 
@@ -845,7 +845,7 @@
   char digit[6];
   int pid, j;
  
-  CTX; /* unused parameter */
+  UNUSED(CTX);
 
   pid = getpid ();
   snprintf (session, sizeof (session), "%8lx%d", (long) time (NULL), pid);
@@ -1080,14 +1080,15 @@
 struct _ds_storage_signature *
 _ds_get_nextsignature (DSPAM_CTX * CTX)
 {
-  CTX; /* unused parameter */
+  UNUSED(CTX);
   return NULL;
 }
 
 int
 _ds_delall_spamrecords (DSPAM_CTX * CTX, ds_diction_t diction)
 {
-  CTX; diction; /* unused parameter */
+  UNUSED(CTX);
+  UNUSED(diction);
   return 0;
 }
 

Modified: trunk/M/lib/dspam/src/libdspam.c
===================================================================
--- trunk/M/lib/dspam/src/libdspam.c	2006-12-25 18:39:58 UTC (rev 7188)
+++ trunk/M/lib/dspam/src/libdspam.c	2006-12-25 19:07:48 UTC (rev 7189)
@@ -2159,7 +2159,7 @@
     }
   }
 #else
-  driver; /* unused parameter */
+  UNUSED(driver);
 #endif
 
 #ifdef NCORE

Modified: trunk/M/lib/dspam/src/pref.c
===================================================================
--- trunk/M/lib/dspam/src/pref.c	2006-12-25 18:39:58 UTC (rev 7188)
+++ trunk/M/lib/dspam/src/pref.c	2006-12-25 19:07:48 UTC (rev 7189)
@@ -170,7 +170,8 @@
   char *p, *q, *bufptr;
   int i = 0;
 
-  config; ignore; /* unused parameters */
+  UNUSED(config);
+  UNUSED(ignore);
 
   if (PTX == NULL) {
     LOG(LOG_CRIT, ERR_MEM_ALLOC);
@@ -308,7 +309,8 @@
   char filename[MAX_FILENAME_LENGTH];
   FILE *out_file;
 
-  config; ignore; /* unused parameters */
+  UNUSED(config);
+  UNUSED(ignore);
 
   if (username == NULL) {
     snprintf(filename, MAX_FILENAME_LENGTH, "%s/default.prefs", home);
@@ -337,7 +339,8 @@
   FILE *out_file;
   int nlines; 
 
-  config; ignore; /* unused parameters */
+  UNUSED(config);
+  UNUSED(ignore);
 
   if (username == NULL) {
     snprintf(filename, MAX_FILENAME_LENGTH, "%s/default.prefs", home);

Modified: trunk/M/lib/dspam/src/util.c
===================================================================
--- trunk/M/lib/dspam/src/util.c	2006-12-25 18:39:58 UTC (rev 7188)
+++ trunk/M/lib/dspam/src/util.c	2006-12-25 19:07:48 UTC (rev 7189)
@@ -626,7 +626,7 @@
 
 int _ds_get_fcntl_lock(int fd) {
 #ifdef _WIN32
-  fd;
+  UNUSED(fd);
 
   return 0;
 #else
@@ -643,7 +643,7 @@
 
 int _ds_free_fcntl_lock(int fd) {
 #ifdef _WIN32
-  fd;
+  UNUSED(fd);
 
   return 0;
 #else


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.