aboutsummaryrefslogtreecommitdiff
path: root/contrib/mandoc/term_tab.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/mandoc/term_tab.c')
-rw-r--r--contrib/mandoc/term_tab.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/contrib/mandoc/term_tab.c b/contrib/mandoc/term_tab.c
index a2d1074159b9..dd1b6bcdc696 100644
--- a/contrib/mandoc/term_tab.c
+++ b/contrib/mandoc/term_tab.c
@@ -1,6 +1,6 @@
-/* $Id: term_tab.c,v 1.7 2021/10/04 18:56:31 schwarze Exp $ */
+/* $Id: term_tab.c,v 1.9 2025/07/16 14:33:08 schwarze Exp $ */
/*
- * Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2017, 2021, 2025 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -27,7 +27,7 @@
#include "term.h"
struct tablist {
- size_t *t; /* Allocated array of tab positions. */
+ size_t *t; /* Allocated array of tab positions [BU]. */
size_t s; /* Allocated number of positions. */
size_t n; /* Currently used number of positions. */
};
@@ -36,7 +36,7 @@ static struct {
struct tablist a; /* All tab positions for lookup. */
struct tablist p; /* Periodic tab positions to add. */
struct tablist *r; /* Tablist currently being recorded. */
- size_t d; /* Default tab width in units of n. */
+ size_t d; /* Default tab width in basic units. */
} tabs;
@@ -55,7 +55,7 @@ term_tab_set(const struct termp *p, const char *arg)
tabs.r = &tabs.a;
if (tabs.d == 0) {
a2roffsu(".8i", &su, SCALE_IN);
- tabs.d = term_hen(p, &su);
+ tabs.d = term_hspan(p, &su);
}
return;
}
@@ -84,28 +84,13 @@ term_tab_set(const struct termp *p, const char *arg)
/* Append the new position. */
- pos = term_hen(p, &su);
+ pos = term_hspan(p, &su);
tl->t[tl->n] = pos;
if (add && tl->n)
tl->t[tl->n] += tl->t[tl->n - 1];
tl->n++;
}
-/*
- * Simplified version without a parser,
- * never incremental, never periodic, for use by tbl(7).
- */
-void
-term_tab_iset(size_t inc)
-{
- if (tabs.a.n >= tabs.a.s) {
- tabs.a.s += 8;
- tabs.a.t = mandoc_reallocarray(tabs.a.t, tabs.a.s,
- sizeof(*tabs.a.t));
- }
- tabs.a.t[tabs.a.n++] = inc;
-}
-
size_t
term_tab_next(size_t prev)
{