]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Use the dirpool_parent inline function
authorMichael Schroeder <mls@suse.de>
Tue, 28 Apr 2026 12:21:43 +0000 (14:21 +0200)
committerMichael Schroeder <mls@suse.de>
Tue, 28 Apr 2026 12:21:43 +0000 (14:21 +0200)
Should be as fast and is much more readable.

src/dirpool.c

index 53a496c536dfcb67cfb42735f29d66273f7eb458..8d49e029cd06f44e675c8504045e3c6aec9861d3 100644 (file)
@@ -167,16 +167,8 @@ dirpool_add_dir(Dirpool *dp, Id parent, Id comp, int create)
   hh = HASHCHAIN_START;
   while ((did = ht[h]) != 0)
     {
-      if (dp->dirs[did] == comp)
-       {
-         /* comp matches, verify parent by walking back to
-          * the block header (short sequential scan) */
-         Id d = did;
-         while (dp->dirs[--d] > 0)
-           ;
-         if (-dp->dirs[d] == parent)
-           return did;
-       }
+      if (dp->dirs[did] == comp && dirpool_parent(dp, did) == parent)
+       return did;
       h = HASHCHAIN_NEXT(h, hh, hm);
     }