summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmcc <mmcc@openbsd.org>2016-01-13 22:47:45 +0000
committermmcc <mmcc@openbsd.org>2016-01-13 22:47:45 +0000
commit4ee32741b048bf08576fb9737868e271e4c59c9c (patch)
tree7265e5a2d819df35c7189488e55ead448064f087
parentTo make bug hunting easier, print more information in the soreceive() (diff)
downloadwireguard-openbsd-4ee32741b048bf08576fb9737868e271e4c59c9c.tar.xz
wireguard-openbsd-4ee32741b048bf08576fb9737868e271e4c59c9c.zip
unify two identical function pairs now that we've removed less's off_t
aliases ok nicm@
-rw-r--r--usr.bin/less/less.h1
-rw-r--r--usr.bin/less/line.c2
-rw-r--r--usr.bin/less/output.c3
-rw-r--r--usr.bin/less/prompt.c24
4 files changed, 8 insertions, 22 deletions
diff --git a/usr.bin/less/less.h b/usr.bin/less/less.h
index 1f8d9a1b32f..db9030a319e 100644
--- a/usr.bin/less/less.h
+++ b/usr.bin/less/less.h
@@ -206,5 +206,4 @@ struct textlist {
/* Functions not included in funcs.h */
void postoa(off_t, char *, size_t);
-void linenumtoa(off_t, char *, size_t);
void inttoa(int, char *, size_t);
diff --git a/usr.bin/less/line.c b/usr.bin/less/line.c
index 65796b3568a..ab6f701921e 100644
--- a/usr.bin/less/line.c
+++ b/usr.bin/less/line.c
@@ -178,7 +178,7 @@ plinenum(off_t pos)
char buf[INT_STRLEN_BOUND(pos) + 2];
int n;
- linenumtoa(linenum, buf, sizeof (buf));
+ postoa(linenum, buf, sizeof(buf));
n = strlen(buf);
if (n < MIN_LINENUM_WIDTH)
n = MIN_LINENUM_WIDTH;
diff --git a/usr.bin/less/output.c b/usr.bin/less/output.c
index d2e22900276..8110a1a27e5 100644
--- a/usr.bin/less/output.c
+++ b/usr.bin/less/output.c
@@ -149,7 +149,6 @@ funcname(type num, char *buf, size_t len) \
}
TYPE_TO_A_FUNC(postoa, off_t)
-TYPE_TO_A_FUNC(linenumtoa, off_t)
TYPE_TO_A_FUNC(inttoa, int)
/*
@@ -173,7 +172,7 @@ iprint_linenum(off_t num)
{
char buf[INT_STRLEN_BOUND(num)];
- linenumtoa(num, buf, sizeof (buf));
+ postoa(num, buf, sizeof(buf));
putstr(buf);
return (strlen(buf));
}
diff --git a/usr.bin/less/prompt.c b/usr.bin/less/prompt.c
index 50f112e97b3..804696d16d7 100644
--- a/usr.bin/less/prompt.c
+++ b/usr.bin/less/prompt.c
@@ -120,19 +120,7 @@ ap_pos(off_t pos)
{
char buf[INT_STRLEN_BOUND(pos) + 2];
- postoa(pos, buf, sizeof buf);
- ap_str(buf);
-}
-
-/*
- * Append a line number to the end of the message.
- */
-static void
-ap_linenum(off_t linenum)
-{
- char buf[INT_STRLEN_BOUND(linenum) + 2];
-
- linenumtoa(linenum, buf, sizeof buf);
+ postoa(pos, buf, sizeof(buf));
ap_str(buf);
}
@@ -255,7 +243,7 @@ protochar(int c, int where)
case 'd': /* Current page number */
linenum = currline(where);
if (linenum > 0 && sc_height > 1)
- ap_linenum(PAGE_NUM(linenum));
+ ap_pos(PAGE_NUM(linenum));
else
ap_quest();
break;
@@ -266,13 +254,13 @@ protochar(int c, int where)
ap_quest();
} else if (len == 0) {
/* An empty file has no pages. */
- ap_linenum(0);
+ ap_pos(0);
} else {
linenum = find_linenum(len - 1);
if (linenum <= 0)
ap_quest();
else
- ap_linenum(PAGE_NUM(linenum));
+ ap_pos(PAGE_NUM(linenum));
}
break;
case 'E': /* Editor name */
@@ -293,7 +281,7 @@ protochar(int c, int where)
case 'l': /* Current line number */
linenum = currline(where);
if (linenum != 0)
- ap_linenum(linenum);
+ ap_pos(linenum);
else
ap_quest();
break;
@@ -303,7 +291,7 @@ protochar(int c, int where)
(linenum = find_linenum(len)) <= 0)
ap_quest();
else
- ap_linenum(linenum-1);
+ ap_pos(linenum-1);
break;
case 'm': /* Number of files */
n = ntags();