From 31044a793c3535a7fddcbade945021e8a17f5e37 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sat, 8 Dec 2007 01:53:58 +0000 Subject: [PATCH] Also activate paging for embedded attr stores. --- src/attr_store.c | 2 +- src/attr_store_p.h | 1 + src/repo_solv.c | 14 ++++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/attr_store.c b/src/attr_store.c index de16bb4..c84af85 100644 --- a/src/attr_store.c +++ b/src/attr_store.c @@ -1137,7 +1137,7 @@ read_idarray(FILE *fp, Id max, Id *map, Id *store, Id *end, int relative) /* Try to either setup on-demand paging (using FP as backing file), or in case that doesn't work (FP not seekable) slurps in all pages and deactivates paging. */ -static void +void read_or_setup_pages (FILE *fp, Attrstore *s) { unsigned int blobsz; diff --git a/src/attr_store_p.h b/src/attr_store_p.h index bc9be3a..acf7786 100644 --- a/src/attr_store_p.h +++ b/src/attr_store_p.h @@ -76,6 +76,7 @@ struct _Attrstore }; void add_attr_from_file (Attrstore *s, unsigned entry, Id name, int type, Id *idmap, unsigned maxid, FILE *fp); +void read_or_setup_pages (FILE *fp, Attrstore *s); #define get_num(ptr,val) do { \ typedef int __wrong_buf__[(1-sizeof((ptr)[0])) * (sizeof((ptr)[0])-1)];\ diff --git a/src/repo_solv.c b/src/repo_solv.c index 61bb9d1..d6a461c 100644 --- a/src/repo_solv.c +++ b/src/repo_solv.c @@ -521,12 +521,6 @@ repo_add_solv(Repo *repo, FILE *fp) case TYPE_ID: read_id(fp, numid + numrel); /* just check Id */ break; - case TYPE_ATTR_CHUNK: - read_id(fp, 0); - /* Fallthrough. */ - case TYPE_ATTR_INT: - read_id(fp, 0); - break; case TYPE_U32: read_u32(fp); break; @@ -540,6 +534,12 @@ repo_add_solv(Repo *repo, FILE *fp) while ((read_u8(fp) & 0xc0) != 0) ; break; + case TYPE_ATTR_CHUNK: + read_id(fp, 0); + /* Fallthrough. */ + case TYPE_ATTR_INT: + read_id(fp, 0); + break; case TYPE_ATTR_INTLIST: case TYPE_ATTR_LOCALIDS: while (read_id(fp, 0) != 0) @@ -787,6 +787,8 @@ repo_add_solv(Repo *repo, FILE *fp) if (embedded_store) { attr_store_pack (embedded_store); + /* If we have any attributes we also have pages. */ + read_or_setup_pages (fp, embedded_store); repo_add_attrstore (repo, embedded_store); } xfree(idmap); -- 2.7.4