From: Michael Schroeder Date: Tue, 29 Jul 2025 13:48:33 +0000 (+0200) Subject: Split off pool_init_rels from pool_create and moveit to poolid.c X-Git-Tag: 0.7.35~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f81f18056cbbcade727ea228ed05e94a43b02931;p=thirdparty%2Flibsolv.git Split off pool_init_rels from pool_create and moveit to poolid.c This allows us to remove the REL_BLOCK definition from poolid_private.h. --- diff --git a/src/pool.c b/src/pool.c index a82b1500..3be2e444 100644 --- a/src/pool.c +++ b/src/pool.c @@ -22,7 +22,6 @@ #include "poolvendor.h" #include "repo.h" #include "poolid.h" -#include "poolid_private.h" #include "poolarch.h" #include "util.h" #include "bitmap.h" @@ -45,11 +44,7 @@ pool_create(void) pool = (Pool *)solv_calloc(1, sizeof(*pool)); stringpool_init(&pool->ss, initpool_data); - - /* alloc space for RelDep 0 */ - pool->rels = solv_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK); - pool->nrels = 1; - memset(pool->rels, 0, sizeof(Reldep)); + pool_init_rels(pool); /* alloc space for Solvable 0 and system solvable */ pool->solvables = solv_extend_resize(0, 2, sizeof(Solvable), SOLVABLE_BLOCK); diff --git a/src/poolid.c b/src/poolid.c index 7e4194f4..3f6d3d88 100644 --- a/src/poolid.c +++ b/src/poolid.c @@ -20,6 +20,8 @@ #include "poolid_private.h" #include "util.h" +#define REL_BLOCK 1023 /* hashtable for relations */ + static inline void grow_whatprovides(Pool *pool, Id id) { @@ -65,6 +67,15 @@ pool_strn2id(Pool *pool, const char *str, unsigned int len, int create) return id; } +void +pool_init_rels(Pool *pool) +{ + /* alloc space for RelDep 0 */ + pool->rels = solv_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK); + pool->nrels = 1; + memset(pool->rels, 0, sizeof(Reldep)); +} + void pool_resize_rels_hash(Pool *pool, int numnew) { diff --git a/src/poolid.h b/src/poolid.h index f832ff4b..7d89692e 100644 --- a/src/poolid.h +++ b/src/poolid.h @@ -41,7 +41,9 @@ extern const char *pool_dep2str(Pool *pool, Id); /* might alloc tmpspace */ extern void pool_shrink_strings(Pool *pool); extern void pool_shrink_rels(Pool *pool); extern void pool_freeidhashes(Pool *pool); -extern void pool_resize_rels_hash(Pool *pool, int numnew); + +extern void pool_resize_rels_hash(Pool *pool, int numnew); /* internal */ +extern void pool_init_rels(Pool *pool); /* internal */ #ifdef __cplusplus } diff --git a/src/poolid_private.h b/src/poolid_private.h index 43ff50d8..0a8c51e9 100644 --- a/src/poolid_private.h +++ b/src/poolid_private.h @@ -13,11 +13,7 @@ #ifndef LIBSOLV_POOLID_PRIVATE_H #define LIBSOLV_POOLID_PRIVATE_H -/* the size of all buffers is incremented in blocks - * these are the block values (increment values) for the - * rel hashtable - */ -#define REL_BLOCK 1023 /* hashtable for relations */ +/* the size of all buffers is incremented in blocks */ #define WHATPROVIDES_BLOCK 1023 #endif /* LIBSOLV_POOLID_PRIVATE_H */