You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/05/26 07:14:14 UTC

svn commit: r178587 - in /spamassassin/trunk/spamc: libspamc.c spamc.c

Author: jm
Date: Wed May 25 22:14:14 2005
New Revision: 178587

URL: http://svn.apache.org/viewcvs?rev=178587&view=rev
Log:
more minor spamc cleanups; convert C++-style comments to C-style comments because we still need to compile on platforms that don't support those; also, don't compare floats using ==, it doesn't always work

Modified:
    spamassassin/trunk/spamc/libspamc.c
    spamassassin/trunk/spamc/spamc.c

Modified: spamassassin/trunk/spamc/libspamc.c
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/spamc/libspamc.c?rev=178587&r1=178586&r2=178587&view=diff
==============================================================================
--- spamassassin/trunk/spamc/libspamc.c (original)
+++ spamassassin/trunk/spamc/libspamc.c Wed May 25 22:14:14 2005
@@ -733,7 +733,8 @@
 
     cp = (dot + 1);
     postdot = (float) (strtol(cp, NULL, 10));
-    if (postdot == 0.0) {
+    /* note: don't compare floats == 0.0, it's unsafe.  use a range */
+    if (postdot >= -0.00001 && postdot <= 0.00001) {
 	return ret;
     }
 

Modified: spamassassin/trunk/spamc/spamc.c
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/spamc/spamc.c?rev=178587&r1=178586&r2=178587&view=diff
==============================================================================
--- spamassassin/trunk/spamc/spamc.c (original)
+++ spamassassin/trunk/spamc/spamc.c Wed May 25 22:14:14 2005
@@ -376,7 +376,7 @@
         }
     }
 
-    // learning action has to block some parameters //
+    /* learning action has to block some parameters */
     if (flags & SPAMC_LEARN) {
         if (flags & SPAMC_CHECK_ONLY) {
 	    libspamc_log(flags, LOG_ERR, "Learning excludes check only");
@@ -433,7 +433,7 @@
 
     while(!(feof(config)) && (fgets(option, 100, config))) {
 
-        count++; // increment the line counter
+        count++; /* increment the line counter */
 
 	if(option[0] == '#' || option[0] == '\n') {
 	    continue;
@@ -447,7 +447,7 @@
 	    }
             combo_argv[*combo_argc] = strdup(tok);
             check_malloc(combo_argv[*combo_argc]);
-            // TODO: leaked.  not a big deal since spamc exits quickly
+            /* TODO: leaked.  not a big deal since spamc exits quickly */
 	    tok = NULL;
 	    *combo_argc+=1;
 	}
@@ -459,7 +459,7 @@
     for(i=1; i<argc; i++) {
         combo_argv[*combo_argc] = strdup(argv[i]);
         check_malloc(combo_argv[*combo_argc]);
-        // TODO: leaked.  not a big deal since spamc exits quickly
+        /* TODO: leaked.  not a big deal since spamc exits quickly */
         *combo_argc+=1;
     }
     return EX_OK;
@@ -632,7 +632,7 @@
     combo_argc = 1;
     combo_argv[0] = strdup(argv[0]);
     check_malloc(combo_argv[0]);
-    // TODO: leaked.  not a big deal since spamc exits quickly
+    /* TODO: leaked.  not a big deal since spamc exits quickly */
  
     for(i=0; i<argc; i++) {
        if(strncmp(argv[i], "-F", 2) == 0) {