Lines Matching defs:pos
69 static void heapifyports(PORT **pp, size_t size, size_t pos);
74 static void heapifypkgs(DEP * d, size_t size, size_t pos);
207 /* Heapify (PORT *) number pos in a pseudo-heap pp[0]..pp[size - 1] */
209 heapifyports(PORT **pp, size_t size, size_t pos)
211 size_t i = pos;
215 /* Find the largest value out of {pos, 2*pos+1, 2*pos+2} */
216 if ((2 * pos + 1 < size) &&
217 (portcompare(pp[i]->portdir, pp[2 * pos + 1]->portdir) < 0))
218 i = 2 * pos + 1;
219 if ((2 * pos + 2 < size) &&
220 (portcompare(pp[i]->portdir, pp[2 * pos + 2]->portdir) < 0))
221 i = 2 * pos + 2;
224 if (i != pos) {
225 tmp = pp[pos];
226 pp[pos] = pp[i];
228 pos = i;
334 heapifypkgs(DEP * d, size_t size, size_t pos)
336 size_t i = pos;
340 /* Find the largest value out of {pos, 2*pos+1, 2*pos+2} */
341 if ((2 * pos + 1 < size) &&
342 (strcmp(d[i].p->pkgname, d[2 * pos + 1].p->pkgname) < 0))
343 i = 2 * pos + 1;
344 if ((2 * pos + 2 < size) &&
345 (strcmp(d[i].p->pkgname, d[2 * pos + 2].p->pkgname) < 0))
346 i = 2 * pos + 2;
349 if (i != pos) {
350 tmp = d[pos].p;
351 d[pos].p = d[i].p;
353 pos = i;