Free up all elements in a flist. */
| 2978 | |
| 2979 | /* Free up all elements in a flist. */ |
| 2980 | void flist_free(struct file_list *flist) |
| 2981 | { |
| 2982 | if (!flist->prev) { |
| 2983 | /* Was FLIST_TEMP dir-list. */ |
| 2984 | } else if (flist == flist->prev) { |
| 2985 | first_flist = cur_flist = NULL; |
| 2986 | file_total = 0; |
| 2987 | flist_cnt = 0; |
| 2988 | } else { |
| 2989 | if (flist == cur_flist) |
| 2990 | cur_flist = flist->next; |
| 2991 | if (flist == first_flist) |
| 2992 | first_flist = first_flist->next; |
| 2993 | else { |
| 2994 | flist->prev->next = flist->next; |
| 2995 | if (!flist->next) |
| 2996 | flist->next = first_flist; |
| 2997 | } |
| 2998 | flist->next->prev = flist->prev; |
| 2999 | file_total -= flist->used; |
| 3000 | flist_cnt--; |
| 3001 | } |
| 3002 | |
| 3003 | if (!flist->prev || !flist_cnt) |
| 3004 | pool_destroy(flist->file_pool); |
| 3005 | else |
| 3006 | pool_free_old(flist->file_pool, flist->pool_boundary); |
| 3007 | |
| 3008 | if (flist->sorted && flist->sorted != flist->files) |
| 3009 | free(flist->sorted); |
| 3010 | free(flist->files); |
| 3011 | free(flist); |
| 3012 | } |
| 3013 | |
| 3014 | /* This routine ensures we don't have any duplicate names in our file list. |
| 3015 | * duplicate names can cause corruption because of the pipelining. */ |
no test coverage detected