static void update_provides_files(const URPM__Package pkg, HV *provides) { if (pkg->h) { STRLEN len; unsigned int i; struct rpmtd_s td_baseNames, td_dirIndexes, td_dirNames; if (headerGet(pkg->h, RPMTAG_BASENAMES, &td_baseNames, HEADERGET_DEFAULT) && headerGet(pkg->h, RPMTAG_DIRINDEXES, &td_dirIndexes, HEADERGET_DEFAULT) && headerGet(pkg->h, RPMTAG_DIRNAMES, &td_dirNames, HEADERGET_DEFAULT)) { char **baseNames = td_baseNames.data; char **dirNames = td_dirNames.data; int32_t *dirIndexes = td_dirIndexes.data; char buff[4096]; char *p; for(i = 0; i < rpmtdCount(&td_baseNames); i++) { len = strlen(dirNames[dirIndexes[i]]); if (len >= sizeof(buff)) continue; memcpy(p = buff, dirNames[dirIndexes[i]], len + 1); p += len; len = strlen(baseNames[i]); if (p - buff + len >= sizeof(buff)) continue; memcpy(p, baseNames[i], len + 1); p += len; update_hash_entry(provides, buff, p-buff, 0, 0, pkg); } rpmtdFreeData(&td_baseNames); rpmtdFreeData(&td_dirNames); } else { struct rpmtd_s td; if (headerGet(pkg->h, RPMTAG_OLDFILENAMES, &td, HEADERGET_DEFAULT)) { for (i = 0; i < rpmtdCount(&td); i++) update_hash_entry(provides, rpmtdNextString(&td), 0, 0, 0, pkg); rpmtdFreeData(&td); } } }