MCPcopy Create free account
hub / github.com/RsyncProject/rsync / init_nno_saw

Function init_nno_saw

compat.c:252–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252static void init_nno_saw(struct name_num_obj *nno, int val)
253{
254 struct name_num_item *nni;
255 int cnt;
256
257 if (!nno->saw_len) {
258 for (nni = nno->list; nni->name; nni++) {
259 if (nni->num >= nno->saw_len)
260 nno->saw_len = nni->num + 1;
261 }
262 }
263
264 if (!nno->saw) {
265 nno->saw = new_array0(uchar, nno->saw_len);
266
267 /* We'll take this opportunity to set the main_nni values for duplicates. */
268 for (cnt = 1, nni = nno->list; nni->name; nni++, cnt++) {
269 if (nni->num == CSUM_gone)
270 continue;
271 if (nno->saw[nni->num])
272 nni->main_nni = &nno->list[nno->saw[nni->num]-1];
273 else
274 nno->saw[nni->num] = cnt;
275 }
276 }
277
278 memset(nno->saw, val, nno->saw_len);
279}
280
281/* Simplify the user-provided string so that it contains valid names without any duplicates.
282 * It also sets the "saw" flags to a 1-relative count of which name was seen first. */

Callers 3

validate_choice_vs_envFunction · 0.85
get_default_nno_listFunction · 0.85
send_negotiate_strFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected