define `resize_capa` as a function

This increases readability and maintainability,
and it also doesn't use reserved identifiers.
Merge pull request #2155 from cremno/define-resize_capa-as-a-function

define `resize_capa` as a function