diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/nvi/patch-power-of-2 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/editors/nvi/patch-power-of-2 b/editors/nvi/patch-power-of-2 new file mode 100644 index 0000000..5f6aaff --- /dev/null +++ b/editors/nvi/patch-power-of-2 @@ -0,0 +1,31 @@ +$NetBSD + +Get rid of "page sizes must be a power-of-2" warning when loading a file. + +--- common/exf.c.orig 2021-07-12 21:21:22.247541289 +0200 ++++ common/exf.c +@@ -228,15 +228,17 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags) + /* + * XXX + * A seat of the pants calculation: try to keep the file in +- * 15 pages or less. Don't use a page size larger than 10K ++ * 15 pages or less. Don't use a page size larger than 16K + * (vi should have good locality) or smaller than 1K. + */ +- psize = ((sb.st_size / 15) + 1023) / 1024; +- if (psize > 10) +- psize = 10; +- if (psize == 0) +- psize = 1; +- psize *= 1024; ++ psize = (sb.st_size > 0) ? ffsl(sb.st_size - 1) + 1 : 0; ++ /* Do these very low limits make sense anymore? */ ++ if (psize < 10) ++ psize = 10; /* 1K */ ++ if (psize > 14) ++ psize = 14; /* 16K */ ++ /* Keep page size on power of 2 boundary to keep db4 happy. */ ++ psize = 1 << psize; + + F_SET(ep, F_DEVSET); + ep->mdev = sb.st_dev; |