struct field_range_pair *frp;
/* Number of finite ranges specified by the user. */
-size_t n_frp;
+idx_t n_frp;
/* Number of `struct field_range_pair's allocated. */
-static size_t n_frp_allocated;
+static idx_t n_frp_allocated;
#define FATAL_ERROR(Message) \
do \
add_range_pair (uintmax_t lo, uintmax_t hi)
{
if (n_frp == n_frp_allocated)
- frp = X2NREALLOC (frp, &n_frp_allocated);
+ frp = xpalloc (frp, &n_frp_allocated, 1, -1, sizeof *frp);
frp[n_frp].lo = lo;
frp[n_frp].hi = hi;
++n_frp;
complement_rp (void)
{
struct field_range_pair *c = frp;
- size_t n = n_frp;
+ idx_t n = n_frp;
frp = nullptr;
n_frp = 0;
if (c[0].lo > 1)
add_range_pair (1, c[0].lo - 1);
- for (size_t i = 1; i < n; ++i)
+ for (idx_t i = 1; i < n; ++i)
{
if (c[i - 1].hi + 1 == c[i].lo)
continue;
{
/* In case the user specified -c$(echo 2^64|bc),22,
complain only about the first number. */
- /* Determine the length of the offending number. */
- size_t len = strspn (num_start, "0123456789");
- char *bad_num = ximemdup0 (num_start, len);
+ char *bad_num = ximemdup0 (num_start,
+ strspn (num_start, "0123456789"));
error (0, 0, (options & SETFLD_ERRMSG_USE_POS)
?_("byte/character offset %s is too large")
:_("field number %s is too large"),
qsort (frp, n_frp, sizeof (frp[0]), compare_ranges);
/* Merge range pairs (e.g. `2-5,3-4' becomes `2-5'). */
- for (size_t i = 0; i < n_frp; ++i)
+ for (idx_t i = 0; i < n_frp; ++i)
{
- for (size_t j = i + 1; j < n_frp; ++j)
+ for (idx_t j = i + 1; j < n_frp; ++j)
{
if (frp[j].lo <= frp[i].hi)
{