From 098014faee4772ac84f1bf0673f7fdad9cf52e99 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 19 Mar 2008 18:39:16 +0000 Subject: [PATCH] - write addedprovides as rel_idarray to save some bytes --- src/repo_solv.c | 15 +++++++++++++-- tools/repo_write.c | 5 ++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/repo_solv.c b/src/repo_solv.c index a543dd3..1268842 100644 --- a/src/repo_solv.c +++ b/src/repo_solv.c @@ -545,12 +545,23 @@ parse_info_repodata(Repodata *maindata, Id *keyp, Repokey *keys, Id *idmap, unsi while ((key = *keyp++) != 0) { id = keys[key].name; - if (id == REPODATA_ADDEDFILEPROVIDES && keys[key].type == REPOKEY_TYPE_IDARRAY) + if (id == REPODATA_ADDEDFILEPROVIDES && keys[key].type == REPOKEY_TYPE_REL_IDARRAY) { + Id old = 0; /* + 1 just in case */ ida = sat_calloc(keys[key].size + 1, sizeof(Id)); - read_idarray(maindata, numid, idmap, ida, ida + keys[key].size + 1); + read_idarray(maindata, 0, 0, ida, ida + keys[key].size + 1); maindata->addedfileprovides = ida; + for (; *ida; ida++) + { + old += *ida - 1; + if (old >= numid) + { + *ida = 0; + break; + } + *ida = idmap ? idmap[old] : old; + } continue; } skip_item(maindata, keys[key].type, numid, numrel); diff --git a/tools/repo_write.c b/tools/repo_write.c index 2a17c18..0bd6118 100644 --- a/tools/repo_write.c +++ b/tools/repo_write.c @@ -946,7 +946,7 @@ repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void key = cbdata.mykeys + cbdata.nmykeys; key->name = REPODATA_ADDEDFILEPROVIDES; - key->type = REPOKEY_TYPE_IDARRAY; + key->type = REPOKEY_TYPE_REL_IDARRAY; key->size = 0; key->storage = KEY_STORAGE_SOLVABLE; cbdata.keymap[key->name] = cbdata.nmykeys++; @@ -1606,8 +1606,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); data_addid(&xd, repodataschemata[i]); if (fileinfo[i].addedfileprovides) { - for (j = 0; fileinfo[i].addedfileprovides[j]; j++) - data_addideof(&xd, needid[fileinfo[i].addedfileprovides[j]].need, fileinfo[i].addedfileprovides[j + 1] ? 0 : 1); + data_addidarray_sort(&xd, pool, needid, fileinfo[i].addedfileprovides, 0); } else { -- 2.34.1