scan_changes Subroutine

public subroutine scan_changes(files, fp_prev, fp_now, changed_idx, changed_count)

Scan files and return indices of changed entries.

changed_idx(1:changed_count) contains the 1-based indices into files for which the fingerprint differs from fp_prev.

Arguments

Type IntentOptional Attributes Name
type(string_t), intent(in), allocatable :: files(:)
integer(kind=int64), intent(in) :: fp_prev(:)
integer(kind=int64), intent(inout) :: fp_now(:)
integer, intent(inout) :: changed_idx(:)
integer, intent(out) :: changed_count

Calls

proc~~scan_changes~~CallsGraph proc~scan_changes scan_changes proc~file_fingerprint file_fingerprint proc~scan_changes->proc~file_fingerprint proc~hash_block hash_block proc~file_fingerprint->proc~hash_block proc~fnv1a_mix_i64 fnv1a_mix_i64 proc~hash_block->proc~fnv1a_mix_i64

Called by

proc~~scan_changes~~CalledByGraph proc~scan_changes scan_changes proc~watcher_run watcher_t%watcher_run proc~watcher_run->proc~scan_changes

Source Code

   subroutine scan_changes(files, fp_prev, fp_now, changed_idx, changed_count)
      type(string_t), allocatable, intent(in) :: files(:)
      integer(int64), intent(in) :: fp_prev(:)
      integer(int64), intent(inout) :: fp_now(:)
      integer, intent(inout) :: changed_idx(:)
      integer, intent(out) :: changed_count
      integer :: i, n

      changed_count = 0
      if (.not. allocated(files)) return
      n = size(files)
      if (n == 0) return

      do i = 1, n
         fp_now(i) = file_fingerprint(files(i)%s)
         if (fp_now(i) /= fp_prev(i)) then
            changed_count = changed_count + 1
            changed_idx(changed_count) = i
         end if
      end do
   end subroutine scan_changes