]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve comment.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Apr 2011 20:27:52 +0000 (13:27 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Apr 2011 20:27:52 +0000 (13:27 -0700)
src/doprnt.c

index db0b66c3aa2cc4cec2cba3a32d69d157f97626e4..22950ec6faddac0df2faed6417a04115ac9602d4 100644 (file)
@@ -199,11 +199,11 @@ doprnt (char *buffer, register size_t bufsize, const char *format,
                  while (fmt < format_end
                         && '0' <= fmt[1] && fmt[1] <= '9')
                    {
-                     /* Avoid int overflow, because many sprintfs seriously
-                        mess up with widths or precisions greater than
-                        INT_MAX.  Avoid size_t overflow, since our counters
-                        use size_t.  This test is slightly conservative, for
-                        speed and simplicity.  */
+                     /* Avoid size_t overflow.  Avoid int overflow too, as
+                        many sprintfs mishandle widths greater than INT_MAX.
+                        This test is simple but slightly conservative: e.g.,
+                        (INT_MAX - INT_MAX % 10) is reported as an overflow
+                        even when it's not.  */
                      if (n >= min (INT_MAX, SIZE_MAX) / 10)
                        error ("Format width or precision too large");
                      n = n * 10 + fmt[1] - '0';