> > > rt.repos = reallocarray(rt.repos, > > > rt.reposz + 1, sizeof(struct repo)); > > > > This line could be unwrapped. The code could also be simplified by using > > recallocarray() (it looks like the -portable update.sh is prepared for > > that). > > I leave that for later. There are a bunch of reallocarrays around the code > that are used in the same way. Let's change them all.
Sure. > > > + /* Look up in repository table. (Lookup should actually fail here) */ > > > + for (i = 0; i < rt.reposz; i++) { > > > + if (rt.repos[i].repouri != NULL || > > > + strcmp(rt.repos[i].local, local)) > > > > While I think this is correct, it looks odd. Couldn't this check for > > rt.repos[i].local != NULL? > > No. The rt.repos[i].repouri check is there to skip repo's added by > repo_lookup. In repo_lookup the same check is there but the other way > around. local on the other hand can't be NULL, it will always be set. Ugh, of course. I misread or misunderstood. Probably both. > I think the repouri check could be removed since there is no way that have > conflicting local repo paths. I will just remove the check. Yes, this makes sense. It is confusing.