-#define COPYDIR_DIRCACHE_SIZE 512
-
-static Id copydir_complex(Pool *pool, Repodata *data, Repodata *fromdata, Id did, Id *cache);
-
-static inline Id
-copydir(Pool *pool, Repodata *data, Repodata *fromdata, Id did, Id *cache)
-{
- if (cache && did && cache[did & 255] == did)
- return cache[(did & 255) + 256];
- return copydir_complex(pool, data, fromdata, did, cache);
-}
-
-static Id
-copydir_complex(Pool *pool, Repodata *data, Repodata *fromdata, Id did, Id *cache)
-{
- Id parent, compid;
- if (!did)
- {
- /* make sure that the dirpool has an entry */
- if (!data->dirpool.ndirs)
- dirpool_add_dir(&data->dirpool, 0, 0, 1);
- return 0;
- }
- parent = dirpool_parent(&fromdata->dirpool, did);
- compid = dirpool_compid(&fromdata->dirpool, did);
- if (parent)
- parent = copydir(pool, data, fromdata, parent, cache);
- if (data->localpool || fromdata->localpool)
- compid = repodata_translate_id(data, fromdata, compid, 1);
- compid = dirpool_add_dir(&data->dirpool, parent, compid, 1);
- if (cache)
- {
- cache[did & 255] = did;
- cache[(did & 255) + 256] = compid;
- }
- return compid;
-}
-