* When the path is realloc'd, have to fix all of the pointers in structures * already returned. */
| 1314 | * already returned. |
| 1315 | */ |
| 1316 | static void |
| 1317 | fts_padjust(FTS* sp) |
| 1318 | { |
| 1319 | FTSENT* p; |
| 1320 | char* addr = sp->fts_path; |
| 1321 | |
| 1322 | #define ADJUST1(p) \ |
| 1323 | { \ |
| 1324 | if ((p)->fts_accpath == (p)->fts_path) \ |
| 1325 | (p)->fts_accpath = (addr); \ |
| 1326 | (p)->fts_path = addr; \ |
| 1327 | } |
| 1328 | /* Adjust the current set of children. */ |
| 1329 | for (p = sp->fts_child; p; p = p->fts_link) { |
| 1330 | ADJUST(p, addr); |
| 1331 | } |
| 1332 | |
| 1333 | /* Adjust the rest of the tree. */ |
| 1334 | for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) { |
| 1335 | ADJUST(p, addr); |
| 1336 | p = p->fts_link ? p->fts_link : p->fts_parent; |
| 1337 | } |
| 1338 | } |
| 1339 | |
| 1340 | static size_t |
| 1341 | fts_maxarglen(char* const* argv) |