MCPcopy Create free account
hub / github.com/coreutils/coreutils / store_columns

Function store_columns

src/pr.c:1951–2000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1949 current line. */
1950
1951static void
1952store_columns (void)
1953{
1954 int i, j;
1955 unsigned int line = 0;
1956 unsigned int buff_start;
1957 int last_col; /* The rightmost column which will be saved in buff */
1958 COLUMN *p;
1959
1960 buff_current = 0;
1961 buff_start = 0;
1962
1963 if (balance_columns)
1964 last_col = columns;
1965 else
1966 last_col = columns - 1;
1967
1968 for (i = 1, p = column_vector; i <= last_col; ++i, ++p)
1969 p->lines_stored = 0;
1970
1971 for (i = 1, p = column_vector; i <= last_col && files_ready_to_read;
1972 ++i, ++p)
1973 {
1974 p->current_line = line;
1975 for (j = lines_per_body; j && files_ready_to_read; --j)
1976
1977 if (p->status == OPEN) /* Redundant. Clean up. */
1978 {
1979 input_position = 0;
1980
1981 if (!read_line (p))
1982 read_rest_of_line (p);
1983
1984 if (p->status == OPEN
1985 || buff_start != buff_current)
1986 {
1987 ++p->lines_stored;
1988 line_vector[line] = buff_start;
1989 end_vector[line++] = input_position;
1990 buff_start = buff_current;
1991 }
1992 }
1993 }
1994
1995 /* Keep track of the location of the last char in buff. */
1996 line_vector[line] = buff_start;
1997
1998 if (balance_columns)
1999 balance (line);
2000}
2001
2002static void
2003balance (int total_stored)

Callers 1

init_pageFunction · 0.85

Calls 3

read_lineFunction · 0.85
read_rest_of_lineFunction · 0.85
balanceFunction · 0.85

Tested by

no test coverage detected