]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Split off pool_init_rels from pool_create and moveit to poolid.c
authorMichael Schroeder <mls@suse.de>
Tue, 29 Jul 2025 13:48:33 +0000 (15:48 +0200)
committerMichael Schroeder <mls@suse.de>
Tue, 29 Jul 2025 14:00:58 +0000 (16:00 +0200)
This allows us to remove the REL_BLOCK definition from
poolid_private.h.

src/pool.c
src/poolid.c
src/poolid.h
src/poolid_private.h

index a82b15006cf8e6c80b96e43f46d0da17888f0163..3be2e444b93075dc7af9325f02db99fdde89052f 100644 (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);
index 7e4194f4630661929efda458be4e6fc863580f2b..3f6d3d88080bda59d734ff786a928511c417ac82 100644 (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)
 {
index f832ff4b3002a17b37e01acc8c6346b299799257..7d89692e7eb730711ca99a57627d2f24ba640047 100644 (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
 }
index 43ff50d81ff65cd5476892b145471abcb3e93053..0a8c51e9a3abb024f189cbb2a4dd5ca61c607df8 100644 (file)
 #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 */