For example, making it look something like this would be better
static void
inc_buf(SCR *sp, VICMD *vp)
{
CHAR_T v = vp->buffer;
if (v < '1' || v > '8') return;
VIP(sp)->sdot.buffer = vp->buffer = ++v;
}
Thanks
Tom
On 10/09/2021 22:24, Stuart Henderson wrote:
On 202
STUART HENDERSON:
Is any particular aspect of the replacement code bad? Being able to
better detect cheesiness in C programs would be nice -- Haskellers are
a different breed and need to be taught some things. ;^)
Note that OMAR POLO modifies the replacement such that the readability
of this re
On 2021/09/10 16:39, VARIK VALEFOR wrote:
> Is any particular aspect of the replacement code bad?
The use of 'magic number' ASCII values obfuscates what the code is
doing.
On 2021/09/10 00:27, VARIK VALEFOR wrote:
> P.S. s/originalBuf/vp->buffer/g
I think this is a good demonstration of why sometimes it's better to have
longer but simpler code.
P.S. s/originalBuf/vp->buffer/g
The CORRECTED diff is as follows:
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,
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..4e30bc62