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

Function init_store_cols

src/pr.c:1916–1937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1914 which we need to know in order to print the last line in buff. */
1915
1916static void
1917init_store_cols (void)
1918{
1919 /* Tune this. */
1920 int total_lines, total_lines_1, chars_per_column_1, chars_if_truncate;
1921 if (ckd_mul (&total_lines, lines_per_body, columns)
1922 || ckd_add (&total_lines_1, total_lines, 1)
1923 || ckd_add (&chars_per_column_1, chars_per_column, 1)
1924 || ckd_mul (&chars_if_truncate, total_lines, chars_per_column_1)
1925 || ckd_mul (&buff_allocated, chars_if_truncate, use_col_separator + 1))
1926 integer_overflow ();
1927
1928 free (line_vector);
1929 /* FIXME: here's where it was allocated. */
1930 line_vector = xnmalloc (total_lines_1, sizeof *line_vector);
1931
1932 free (end_vector);
1933 end_vector = xnmalloc (total_lines, sizeof *end_vector);
1934
1935 free (buff);
1936 buff = ximalloc (buff_allocated);
1937}
1938
1939/* Store all but the rightmost column.
1940 (Used when printing a single file in multiple downward columns)

Callers 1

print_filesFunction · 0.85

Calls 1

integer_overflowFunction · 0.85

Tested by

no test coverage detected