int rpmtdFromArgi(rpmtd td, rpmTagVal tag, ARGI_t argi) { int count = argiCount(argi); rpmTagType type = rpmTagGetTagType(tag); rpmTagReturnType retype = rpmTagGetReturnType(tag); if (type != RPM_INT32_TYPE || retype != RPM_ARRAY_RETURN_TYPE || count < 1) return 0; return rpmtdSet(td, tag, type, argiData(argi), count); }
int argiSort(ARGI_t argi, int (*compar)(ARGint_t *, ARGint_t *)) { unsigned nvals = argiCount(argi); ARGint_t vals = argiData(argi); if (compar == NULL) compar = argiCmp; if (nvals > 1) qsort(vals, nvals, sizeof(*vals), (int(*)(const void *, const void *))compar); return 0; }