Code quality improvements in heat topology

Ensure that functions are not declared conditionally and
that they are declared before being assigned as callbacks.

This commit contains no code changes, only rearrangement
plus whitespace and semicolon fixes.

Fixes Bug #1226945

Change-Id: Ie549d48d0ea47d00d904b36555bd68c95ad12f49
Merge "Code quality improvements in heat topology"