Figure out if a prior entry is still there or if we just have a * cached name for it. */
| 244 | /* Figure out if a prior entry is still there or if we just have a |
| 245 | * cached name for it. */ |
| 246 | static char *check_prior(struct file_struct *file, int gnum, |
| 247 | int *prev_ndx_p, struct file_list **flist_p) |
| 248 | { |
| 249 | struct file_struct *fp; |
| 250 | struct ht_int32_node *node; |
| 251 | int prev_ndx = F_HL_PREV(file); |
| 252 | |
| 253 | while (1) { |
| 254 | struct file_list *flist; |
| 255 | if (prev_ndx < 0 |
| 256 | || (flist = flist_for_ndx(prev_ndx, NULL)) == NULL) |
| 257 | break; |
| 258 | fp = flist->files[prev_ndx - flist->ndx_start]; |
| 259 | if (!(fp->flags & FLAG_SKIP_HLINK)) { |
| 260 | *prev_ndx_p = prev_ndx; |
| 261 | *flist_p = flist; |
| 262 | return NULL; |
| 263 | } |
| 264 | F_HL_PREV(file) = prev_ndx = F_HL_PREV(fp); |
| 265 | } |
| 266 | |
| 267 | if (inc_recurse |
| 268 | && (node = hashtable_find(prior_hlinks, gnum, NULL)) != NULL) { |
| 269 | assert(node->data != NULL); |
| 270 | if (CVAL(node->data, 0) != 0) { |
| 271 | *prev_ndx_p = -1; |
| 272 | *flist_p = NULL; |
| 273 | return node->data; |
| 274 | } |
| 275 | /* The prior file must have been skipped. */ |
| 276 | F_HL_PREV(file) = -1; |
| 277 | } |
| 278 | |
| 279 | *prev_ndx_p = -1; |
| 280 | *flist_p = NULL; |
| 281 | return NULL; |
| 282 | } |
| 283 | |
| 284 | /* Only called if FLAG_HLINKED is set and FLAG_HLINK_FIRST is not. Returns: |
| 285 | * 0 = process the file, 1 = skip the file, -1 = error occurred. */ |
no test coverage detected