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

Function complement_rp

src/set-fields.c:69–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 entries outside the range of each specified entry. */
68
69static void
70complement_rp (void)
71{
72 struct field_range_pair *c = frp;
73 idx_t n = n_frp;
74
75 frp = NULL;
76 n_frp = 0;
77 n_frp_allocated = 0;
78
79 if (c[0].lo > 1)
80 add_range_pair (1, c[0].lo - 1);
81
82 for (idx_t i = 1; i < n; ++i)
83 {
84 if (c[i - 1].hi + 1 == c[i].lo)
85 continue;
86
87 add_range_pair (c[i - 1].hi + 1, c[i].lo - 1);
88 }
89
90 if (c[n - 1].hi < UINTMAX_MAX)
91 add_range_pair (c[n - 1].hi + 1, UINTMAX_MAX);
92
93 free (c);
94}
95
96/* Given the list of field or byte range specifications FIELDSTR,
97 allocate and initialize the FRP array. FIELDSTR should

Callers 1

set_fieldsFunction · 0.85

Calls 1

add_range_pairFunction · 0.85

Tested by

no test coverage detected