Ticket #22228: nvi.patch

File nvi.patch, 1.6 KB (added by qbarnes (Quentin Barnes), 14 years ago)

Patch to address "page size must be power-of-2" message.

  • (a) Portfile-dist vs. (b) Portfile

    a b  
    44
    55name            nvi
    66version         1.81.6
    7 revision        1
     7revision        2
    88categories      editors
    99maintainers     toby
    1010description     A vi/ex clone
     
    2929    patch-common__db.h \
    3030    patch-common__key.h \
    3131    patch-dist__port.h.in \
    32     patch-ex_script.c.diff
     32    patch-ex_script.c.diff \
     33    patch-powerof2.diff
    3334
    3435configure.args \
    3536    --program-prefix=n \
  • files/patch-powerof2.

    old new  
     1Get rid of "page sizes must be a power-of-2" warning when loading a file.
     2
     3--- ../common/exf.c-dist        2007-11-18 10:41:42.000000000 -0600
     4+++ ../common/exf.c     2010-08-21 16:19:45.000000000 -0500
     5@@ -228,15 +228,17 @@
     6                /*
     7                 * XXX
     8                 * A seat of the pants calculation: try to keep the file in
     9-                * 15 pages or less.  Don't use a page size larger than 10K
     10+                * 15 pages or less.  Don't use a page size larger than 16K
     11                 * (vi should have good locality) or smaller than 1K.
     12                 */
     13-               psize = ((sb.st_size / 15) + 1023) / 1024;
     14-               if (psize > 10)
     15-                       psize = 10;
     16-               if (psize == 0)
     17-                       psize = 1;
     18-               psize *= 1024;
     19+               psize = (sb.st_size > 0) ? ffsl(sb.st_size - 1) + 1 : 0;
     20+               /* Do these very low limits make sense anymore? */
     21+               if (psize < 10)
     22+                       psize = 10;  /* 1K  */
     23+               if (psize > 14)
     24+                       psize = 14;  /* 16K */
     25+               /* Keep page size on power of 2 boundary to keep db4 happy. */
     26+               psize = 1 << psize;
     27 
     28                F_SET(ep, F_DEVSET);
     29                ep->mdev = sb.st_dev;