Heat capacity of mesoscopically disordered superconductors with emphasis on MgB2