bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of 0 instead of NULL in src/kwset.c


From: Charles Levert
Subject: Re: Use of 0 instead of NULL in src/kwset.c
Date: Mon, 4 Jul 2005 01:34:02 -0400
User-agent: Mutt/1.4.1i

* On Sunday 2005-07-03 at 20:47:58 +0100, Julian Foad wrote:
> 
> I agree and would support such a change.  I do not think there are any 
> portability problems.  The only concern I have is that you should check 
> whether there are any large patches to this file currently in our patch 
> tracker.

I went ahead and applied some changes there.

I think the only pending patch that's affected
is one you were working on to fix a bug.  I would
now propose



--- src/kwset.c 2005-07-04 01:14:37 -0400
+++ src/kwset.c 2005-06-23 20:19:59 -0400
@@ -404,7 +404,13 @@ kwsprep (kwset_t kws)
        }
       /* Build the Boyer Moore delta.  Boy that's easy compared to CW. */
       for (i = 0; i < kwset->mind; ++i)
-       delta[U(kwset->target[i])] = kwset->mind - (i + 1);
+       {
+         unsigned u = kwset->mind - (i + 1);
+
+         if (UCHAR_MAX < u)
+           u = UCHAR_MAX;
+         delta[U(kwset->target[i])] = u;
+       }
       /* Find the minimal delta2 shift that we might make after
         a backwards match has failed. */
       c = kwset->target[kwset->mind - 1];



along with tests that would be surrounded by a

   for mode in F G E

loop in "tests/foad1.sh".  I still have to fully
understand how this delta[] array is used and
may (or not) suggest additional individual tests
later on.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]