When reading in from the modeline in buffer.c, mg uses a pointer
called bufp pointing to a buffer called bufn. It would seem to make
sense to use bufp in any further processing. These functions don't:

switch-to-buffer-other-window   (poptobuffer())
kill-buffer                     (killbuffer_cmd())
insert-buffer                   (bufferinsert())

This diff changes the above three instances to use bufp instead of
bufn once eread() has been used.  No functional change intended.

ok?

Index: buffer.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/buffer.c,v
retrieving revision 1.110
diff -u -p -r1.110 buffer.c
--- buffer.c    18 Mar 2021 18:09:21 -0000      1.110
+++ buffer.c    23 Mar 2021 10:00:31 -0000
@@ -144,7 +144,7 @@ poptobuffer(int f, int n)
                return (ABORT);
        if (bufp[0] == '\0' && curbp->b_altb != NULL)
                bp = curbp->b_altb;
-       else if ((bp = bfind(bufn, TRUE)) == NULL)
+       else if ((bp = bfind(bufp, TRUE)) == NULL)
                return (FALSE);
        if (bp == curbp)
                return (splitwind(f, n));
@@ -178,7 +178,7 @@ killbuffer_cmd(int f, int n)
                return (ABORT);
        else if (bufp[0] == '\0')
                bp = curbp;
-       else if ((bp = bfind(bufn, FALSE)) == NULL)
+       else if ((bp = bfind(bufp, FALSE)) == NULL)
                return (FALSE);
        ret = killbuffer(bp);
        eerase();
@@ -782,7 +782,7 @@ bufferinsert(int f, int n)
                return (ABORT);
        if (bufp[0] == '\0' && curbp->b_altb != NULL)
                bp = curbp->b_altb;
-       else if ((bp = bfind(bufn, FALSE)) == NULL)
+       else if ((bp = bfind(bufp, FALSE)) == NULL)
                return (FALSE);

        if (bp == curbp)

Reply via email to