- if (language && !language[0])
- language = 0;
- if (!language || tag >= ID_NUM_INTERNAL)
- return pool_id2langid(pd->common.repo->pool, tag, language, 1);
- return pool_id2langid(pd->common.repo->pool, tag, language, 1);
- if (!pd->langcache[tag])
- pd->langcache[tag] = pool_id2langid(pd->common.repo->pool, tag, language, 1);
- return pd->langcache[tag];
-}
-
-static int
-id3_cmp (const void *v1, const void *v2, void *dp)
-{
- Id *i1 = (Id*)v1;
- Id *i2 = (Id*)v2;
- return i1[0] - i2[0];
-}
-
-static void
-commit_diskusage (struct parsedata *pd, unsigned handle)
-{
- unsigned i;
- Dirpool *dp = &pd->data->dirpool;
- /* Now sort in dirid order. This ensures that parents come before
- their children. */
- if (pd->ndirs > 1)
- sat_sort(pd->dirs, pd->ndirs, sizeof (pd->dirs[0]), id3_cmp, 0);
- /* Substract leaf numbers from all parents to make the numbers
- non-cumulative. This must be done post-order (i.e. all leafs
- adjusted before parents). We ensure this by starting at the end of
- the array moving to the start, hence seeing leafs before parents. */
- for (i = pd->ndirs; i--;)
- {
- unsigned p = dirpool_parent(dp, pd->dirs[i][0]);
- unsigned j = i;
- for (; p; p = dirpool_parent(dp, p))
- {
- for (; j--;)
- if (pd->dirs[j][0] == p)
- break;
- if (j < pd->ndirs)
- {
- if (pd->dirs[j][1] < pd->dirs[i][1])
- pd->dirs[j][1] = 0;
- else
- pd->dirs[j][1] -= pd->dirs[i][1];
- if (pd->dirs[j][2] < pd->dirs[i][2])
- pd->dirs[j][2] = 0;
- else
- pd->dirs[j][2] -= pd->dirs[i][2];
- }
- else
- /* Haven't found this parent in the list, look further if
- we maybe find the parents parent. */
- j = i;
- }
- }
-#if 0
- char sbuf[1024];
- char *buf = sbuf;
- unsigned slen = sizeof (sbuf);
- for (i = 0; i < pd->ndirs; i++)