d-wave superconductivity near charge instabilities.