push_feature Subroutine

public subroutine push_feature(features, name)

Append a feature name to a string_t array if not already present.

This is used both for plugin feature names and for ignore/include patterns.

Arguments

Type IntentOptional Attributes Name
type(string_t), intent(inout), allocatable :: features(:)
character(len=*), intent(in) :: name

Called by

proc~~push_feature~~CalledByGraph proc~push_feature push_feature proc~add_features_csv add_features_csv proc~add_features_csv->proc~push_feature proc~apply_watch_flag apply_watch_flag proc~apply_watch_flag->proc~push_feature proc~parse_cli parse_cli proc~parse_cli->proc~push_feature proc~parse_cli->proc~add_features_csv proc~parse_cli->proc~apply_watch_flag proc~parse_cli_config parse_cli_config proc~parse_cli_config->proc~parse_cli

Source Code

   subroutine push_feature(features, name)
      type(string_t), allocatable, intent(inout) :: features(:)
      character(len=*), intent(in) :: name
      integer :: n, i
      type(string_t), allocatable :: tmp(:)

      if (len_trim(name) == 0) return

      if (.not. allocated(features)) then
         allocate(features(1))
         features(1)%s = trim(name)
         return
      end if

      do i = 1, size(features)
         if (trim(features(i)%s) == trim(name)) return
      end do

      n = size(features)
      allocate(tmp(n+1))
      tmp(1:n) = features
      tmp(n+1)%s = trim(name)
      call move_alloc(tmp, features)
   end subroutine push_feature