Dispersion relations for vacuum-polarization functions in electroweak physics