summaryrefslogtreecommitdiff
path: root/src/unexpand.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-01-04 21:09:30 +0000
committerJim Meyering <jim@meyering.net>2004-01-04 21:09:30 +0000
commit5ad984ecc0546129cdd29eeb4808c5d8733a6935 (patch)
treeb40f3608d73c26fc0607d68d9552a1f5022959ab /src/unexpand.c
parent986b0ecbdfdbdd76cd39a92e7b4dd837654b3fc7 (diff)
downloadcoreutils-5ad984ecc0546129cdd29eeb4808c5d8733a6935.tar.xz
(n_tabs_allocated): New global.
(add_tabstop): Use x2nrealloc rather than xrealloc.
Diffstat (limited to 'src/unexpand.c')
-rw-r--r--src/unexpand.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/unexpand.c b/src/unexpand.c
index ac50629e6..c65c210a9 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -76,6 +76,7 @@ static int tab_size;
after `tab_list' is exhausted, the rest of the line is printed
unchanged. The first column is column 0. */
static int *tab_list;
+static size_t n_tabs_allocated;
/* The index of the first invalid element of `tab_list',
where the next element can be added. */
@@ -121,8 +122,8 @@ add_tabstop (int tabval)
{
if (tabval == -1)
return;
- if (first_free_tab % TABLIST_BLOCK == 0)
- tab_list = xrealloc (tab_list, first_free_tab + TABLIST_BLOCK);
+ if (first_free_tab == n_tabs_allocated)
+ tab_list = x2nrealloc (tab_list, &n_tabs_allocated, sizeof *tab_list);
tab_list[first_free_tab++] = tabval;
}