summaryrefslogtreecommitdiff
path: root/src/poolid.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2008-01-29 16:14:03 +0000
committerMichael Schroeder <mls@suse.de>2008-01-29 16:14:03 +0000
commit5bb97e51a00ec15f1cb6bd6b5f3b4befd0263e1d (patch)
treee70c1d84501ba17323588be5a6d6e0970155285e /src/poolid.c
parentcf2556872b850f5d9c26975b5e287a4bf7ef38ca (diff)
downloadlibsolv-5bb97e51a00ec15f1cb6bd6b5f3b4befd0263e1d.tar.gz
libsolv-5bb97e51a00ec15f1cb6bd6b5f3b4befd0263e1d.tar.bz2
libsolv-5bb97e51a00ec15f1cb6bd6b5f3b4befd0263e1d.zip
- add key filtering to repo_write
- change repo_write so that it combines all available data - integrate attr_store into repodata - write storage parameter with every key, bump solv revision to 5 - don't create system rules for atoms - change repo_susetags to use repodata interface
Diffstat (limited to 'src/poolid.c')
-rw-r--r--src/poolid.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/poolid.c b/src/poolid.c
index 8a06437..6911367 100644
--- a/src/poolid.c
+++ b/src/poolid.c
@@ -38,6 +38,20 @@ str2id(Pool *pool, const char *str, int create)
}
Id
+strn2id(Pool *pool, const char *str, unsigned int len, int create)
+{
+ int oldnstrings = pool->ss.nstrings;
+ Id id = stringpool_strn2id (&pool->ss, str, len, create);
+ if (create && oldnstrings != pool->ss.nstrings && (id & WHATPROVIDES_BLOCK) == 0)
+ {
+ /* grow whatprovides array */
+ pool->whatprovides = sat_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset));
+ memset(pool->whatprovides + id, 0, (WHATPROVIDES_BLOCK + 1) * sizeof(Offset));
+ }
+ return id;
+}
+
+Id
rel2id(Pool *pool, Id name, Id evr, int flags, int create)
{
Hashval h;
@@ -86,8 +100,7 @@ rel2id(Pool *pool, Id name, Id evr, int flags, int create)
id = pool->nrels++;
/* extend rel space if needed */
- if ((id & REL_BLOCK) == 0)
- pool->rels = sat_realloc(pool->rels, ((pool->nrels + REL_BLOCK) & ~REL_BLOCK) * sizeof(Reldep));
+ pool->rels = sat_extend(pool->rels, id, 1, sizeof(Reldep), REL_BLOCK);
hashtbl[h] = id;
ran = pool->rels + id;
ran->name = name;
@@ -247,7 +260,7 @@ pool_shrink_strings(Pool *pool)
void
pool_shrink_rels(Pool *pool)
{
- pool->rels = (Reldep *)sat_realloc(pool->rels, ((pool->nrels + REL_BLOCK) & ~REL_BLOCK) * sizeof(Reldep));
+ pool->rels = sat_extend_resize(pool->rels, pool->nrels, sizeof(Reldep), REL_BLOCK);
}
// reset all hash tables