1
0
mirror of https://github.com/openSUSE/libsolv.git synced 2026-02-05 12:45:46 +01:00

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.
This commit is contained in:
Michael Schroeder
2025-07-29 15:48:33 +02:00
parent 94600551b1
commit f81f18056c
4 changed files with 16 additions and 12 deletions

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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
}

View File

@@ -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 */