7 Mar
2009
7 Mar
'09
8:54 p.m.
Nagy Gabor wrote:
+ + /* Destroy all packages which are in trans->packages but not in + newpkgs before replacing trans->packages with newpkgs */ + for(i = trans->packages; i; i = i->next) { + pmsyncpkg_t *spkg = (pmsyncpkg_t *) i->data; + for (j = newpkgs; j; j = j->next) { + if(_alpm_pkg_cmp(spkg->pkg, ((pmsyncpkg_t *) j->data)->pkg) == 0) { + spkg = NULL; + break; + } + } + if (spkg != NULL) { + _alpm_sync_free(spkg); + } + } +
Wow, this is ugly. But that is not your fault: I think this motivated me to finally kill pmsyncpkg_t.
Your concept of ugly must be very different from mine. It's just code to free members of a list that are no longer needed. What is ugly about that? Bryan