Sir or Madam:

The attached diff significantly decreases the length of a function...
and potentially increases the readability of this function.

Don't stop skankin',
Varik "NOT A COMPUTER PROGRAMMER!!!" Valefor

diff --git a/usr.bin/vi/vi/v_put.c b/usr.bin/vi/vi/v_put.c
index 959d4a47698..4e30bc620d3 100644
--- a/usr.bin/vi/vi/v_put.c
+++ b/usr.bin/vi/vi/v_put.c
@@ -104,35 +104,6 @@ v_put(SCR *sp, VICMD *vp)
 static void
 inc_buf(SCR *sp, VICMD *vp)
 {
-       CHAR_T v;
-
-       switch (vp->buffer) {
-       case '1':
-               v = '2';
-               break;
-       case '2':
-               v = '3';
-               break;
-       case '3':
-               v = '4';
-               break;
-       case '4':
-               v = '5';
-               break;
-       case '5':
-               v = '6';
-               break;
-       case '6':
-               v = '7';
-               break;
-       case '7':
-               v = '8';
-               break;
-       case '8':
-               v = '9';
-               break;
-       default:
-               return;
-       }
-       VIP(sp)->sdot.buffer = vp->buffer = v;
+       if (vp->buffer > 48 && originalBuf < 57)
+               VIP(sp)->sdot.buffer = vp->buffer = originalBuf + 1;
 }

Reply via email to