Also activate paging for embedded attr stores.
authorMichael Matz <matz@suse.de>
Sat, 8 Dec 2007 01:53:58 +0000 (01:53 +0000)
committerMichael Matz <matz@suse.de>
Sat, 8 Dec 2007 01:53:58 +0000 (01:53 +0000)
src/attr_store.c
src/attr_store_p.h
src/repo_solv.c

index de16bb4..c84af85 100644 (file)
@@ -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;
index bc9be3a..acf7786 100644 (file)
@@ -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)];\
index 61bb9d1..d6a461c 100644 (file)
@@ -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);