Initialize fingerprint arrays for a watch list.
Allocates fp_prev, fp_now, and changed_idx to match the size of
files. Initial fingerprints are computed once and copied into fp_now.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(in), | allocatable | :: | files(:) | ||
| integer(kind=int64), | intent(inout), | allocatable | :: | fp_prev(:) | ||
| integer(kind=int64), | intent(inout), | allocatable | :: | fp_now(:) | ||
| integer, | intent(inout), | allocatable | :: | changed_idx(:) |
subroutine init_fingerprints(files, fp_prev, fp_now, changed_idx) type(string_t), allocatable, intent(in) :: files(:) integer(int64), allocatable, intent(inout) :: fp_prev(:) integer(int64), allocatable, intent(inout) :: fp_now(:) integer, allocatable, intent(inout) :: changed_idx(:) integer :: n, i if (.not. allocated(files)) then if (allocated(fp_prev)) deallocate(fp_prev) if (allocated(fp_now)) deallocate(fp_now) if (allocated(changed_idx)) deallocate(changed_idx) allocate(fp_prev(0), fp_now(0), changed_idx(0)) return end if n = size(files) if (allocated(fp_prev)) deallocate(fp_prev) if (allocated(fp_now)) deallocate(fp_now) if (allocated(changed_idx)) deallocate(changed_idx) allocate(fp_prev(n), fp_now(n), changed_idx(n)) do i = 1, n fp_prev(i) = file_fingerprint(files(i)%s) end do fp_now = fp_prev end subroutine init_fingerprints