From 25e1ddb950b7f08b3f2c415e10098a10a7336619 Mon Sep 17 00:00:00 2001 From: bcallah Date: Wed, 3 Jun 2015 23:40:01 +0000 Subject: [PATCH] Remove unused defines and functions. "Looks fine." deraadt@ --- usr.bin/mg/def.h | 14 +------ usr.bin/mg/line.c | 96 +--------------------------------------------- usr.bin/mg/match.c | 5 +-- 3 files changed, 5 insertions(+), 110 deletions(-) diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h index 73784d3d436..88e86ae1a82 100644 --- a/usr.bin/mg/def.h +++ b/usr.bin/mg/def.h @@ -1,4 +1,4 @@ -/* $OpenBSD: def.h,v 1.146 2015/05/08 12:35:08 bcallah Exp $ */ +/* $OpenBSD: def.h,v 1.147 2015/06/03 23:40:01 bcallah Exp $ */ /* This file is in the public domain. */ @@ -21,13 +21,13 @@ typedef int (*PF)(int, int); /* generally useful type */ #define NBUFN NFILEN /* Length, buffer name. */ #define NLINE 256 /* Length, line. */ #define PBMODES 4 /* modes per buffer */ -#define NKBDM 256 /* Length, keyboard macro. */ #define NPAT 80 /* Length, pattern. */ #define HUGE 1000 /* A rather large number. */ #define NSRCH 128 /* Undoable search commands. */ #define NXNAME 64 /* Length, extended command. */ #define NKNAME 20 /* Length, key names. */ #define NTIME 50 /* Length, timestamp string. */ + /* * Universal. */ @@ -60,13 +60,6 @@ typedef int (*PF)(int, int); /* generally useful type */ #define FIOLONG 4 /* long line partially read */ #define FIODIR 5 /* File is a directory */ -/* - * Directory I/O. - */ -#define DIOSUC 0 /* Success. */ -#define DIOEOF 1 /* End of file. */ -#define DIOERR 2 /* Error. */ - /* * Display colors. */ @@ -388,7 +381,6 @@ struct line *lalloc(int); int lrealloc(struct line *, int); void lfree(struct line *); void lchange(int); -int linsert_str(const char *, int); int linsert(int, int); int lnewline_at(struct line *, int); int lnewline(void); @@ -408,7 +400,6 @@ int yank(int, int); /* window.c X */ struct mgwin *new_window(struct buffer *); -void free_window(struct mgwin *); int reposition(int, int); int redraw(int, int); int do_redraw(int, int, int); @@ -654,7 +645,6 @@ int executemacro(int, int); /* modes.c X */ int indentmode(int, int); int fillmode(int, int); -int blinkparen(int, int); #ifdef NOTAB int notabmode(int, int); #endif /* NOTAB */ diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c index 81a28e5b72a..998bd859cc9 100644 --- a/usr.bin/mg/line.c +++ b/usr.bin/mg/line.c @@ -1,4 +1,4 @@ -/* $OpenBSD: line.c,v 1.55 2015/03/19 21:22:15 bcallah Exp $ */ +/* $OpenBSD: line.c,v 1.56 2015/06/03 23:40:01 bcallah Exp $ */ /* This file is in the public domain. */ @@ -130,100 +130,6 @@ lchange(int flag) } } -/* - * Insert "n" bytes from "s" at the current location of dot. - * In the easy case all that happens is the text is stored in the line. - * In the hard case, the line has to be reallocated. When the window list - * is updated, take special care; I screwed it up once. You always update - * dot in the current window. You update mark and a dot in another window - * if it is greater than the place where you did the insert. Return TRUE - * if all is well, and FALSE on errors. - */ -int -linsert_str(const char *s, int n) -{ - struct line *lp1; - struct mgwin *wp; - RSIZE i; - int doto, k; - - if ((k = checkdirty(curbp)) != TRUE) - return (k); - - if (curbp->b_flag & BFREADONLY) { - dobeep(); - ewprintf("Buffer is read only"); - return (FALSE); - } - - if (!n) - return (TRUE); - - lchange(WFFULL); - - /* current line */ - lp1 = curwp->w_dotp; - - /* special case for the end */ - if (lp1 == curbp->b_headp) { - struct line *lp2, *lp3; - - /* now should only happen in empty buffer */ - if (curwp->w_doto != 0) - panic("bug: linsert_str"); - /* allocate a new line */ - if ((lp2 = lalloc(n)) == NULL) - return (FALSE); - /* previous line */ - lp3 = lp1->l_bp; - /* link in */ - lp3->l_fp = lp2; - lp2->l_fp = lp1; - lp1->l_bp = lp2; - lp2->l_bp = lp3; - for (i = 0; i < n; ++i) - lp2->l_text[i] = s[i]; - for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { - if (wp->w_linep == lp1) - wp->w_linep = lp2; - if (wp->w_dotp == lp1) - wp->w_dotp = lp2; - if (wp->w_markp == lp1) - wp->w_markp = lp2; - } - undo_add_insert(lp2, 0, n); - curwp->w_doto = n; - return (TRUE); - } - /* save for later */ - doto = curwp->w_doto; - - if ((lp1->l_used + n) > lp1->l_size) { - if (lrealloc(lp1, lp1->l_used + n) == FALSE) - return (FALSE); - } - lp1->l_used += n; - if (lp1->l_used != n) - memmove(&lp1->l_text[doto + n], &lp1->l_text[doto], - lp1->l_used - n - doto); - - /* Add the characters */ - for (i = 0; i < n; ++i) - lp1->l_text[doto + i] = s[i]; - for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { - if (wp->w_dotp == lp1) { - if (wp == curwp || wp->w_doto > doto) - wp->w_doto += n; - } - if (wp->w_markp == lp1) { - if (wp->w_marko > doto) - wp->w_marko += n; - } - } - undo_add_insert(curwp->w_dotp, doto, n); - return (TRUE); -} - /* * Insert "n" copies of the character "c" at the current location of dot. * In the easy case all that happens is the text is stored in the line. diff --git a/usr.bin/mg/match.c b/usr.bin/mg/match.c index ea961d56382..e73a291bafb 100644 --- a/usr.bin/mg/match.c +++ b/usr.bin/mg/match.c @@ -1,4 +1,4 @@ -/* $OpenBSD: match.c,v 1.18 2015/03/19 21:22:15 bcallah Exp $ */ +/* $OpenBSD: match.c,v 1.19 2015/06/03 23:40:01 bcallah Exp $ */ /* This file is in the public domain. */ @@ -81,8 +81,7 @@ balance(void) /* * Move behind the inserted character. We are always guaranteed - * that there is at least one character on the line, since one was - * just self-inserted by blinkparen. + * that there is at least one character on the line. */ clp = curwp->w_dotp; cbo = curwp->w_doto - 1; -- 2.20.1