Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure no empty dependencies in dependency tree #1001

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/fpm/dependency.f90
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ recursive subroutine add_project_dependencies(self, package, root, main, error)
end if
end if

!> Ensure allocation fits
call resize(self%dep,self%ndep)

end subroutine add_project_dependencies

!> Add a list of dependencies to the dependency tree
Expand All @@ -430,6 +433,9 @@ subroutine add_dependencies(self, dependency, error)
end do
if (allocated(error)) return

!> Ensure allocation fits ndep
call resize(self%dep,self%ndep)

end subroutine add_dependencies

!> Add a single dependency node to the dependency tree
Expand Down Expand Up @@ -464,6 +470,10 @@ subroutine add_dependency_node(self, dependency, error)
end if
end if
else

!> Safety: reallocate if necessary
if (size(self%dep)==self%ndep) call resize(self%dep,self%ndep+1)

! New dependency: add from scratch
self%ndep = self%ndep + 1
self%dep(self%ndep) = dependency
Expand Down
Loading