AcpiSrc: Prevent two possible div-by-zero conditions.

Ensure statistics display does not divide-by-zero.
This commit is contained in:
Robert Moore 2012-06-13 13:50:52 -07:00
parent 5ee27590d9
commit b71852ab29

View File

@ -317,10 +317,18 @@ AsDisplayStats (
printf ("%8u Lines of non-comment whitespace\n", Gbl_WhiteLines);
printf ("%8u Lines of comments\n", Gbl_CommentLines);
printf ("%8u Long lines found\n", Gbl_LongLines);
if (Gbl_WhiteLines > 0)
{
printf ("%8.1f Ratio of code to whitespace\n",
((float) Gbl_SourceLines / (float) Gbl_WhiteLines));
}
if ((Gbl_CommentLines + Gbl_NonAnsiComments) > 0)
{
printf ("%8.1f Ratio of code to comments\n",
((float) Gbl_SourceLines / (float) (Gbl_CommentLines + Gbl_NonAnsiComments)));
}
if (!Gbl_TotalLines)
{