X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/620f13b0612810324592ab2d2b4e5a5dab27f981..4618713ae48aac51c6f1a2474cc981f32c2bbede:/src/doprnt.c diff --git a/src/doprnt.c b/src/doprnt.c index b36e946005..471e35c7b4 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -1,7 +1,7 @@ /* Output like sprintf to a buffer of specified size. Also takes args differently: pass one pointer to the end of the format string in addition to the format string itself. - Copyright (C) 1985, 2001-2012 Free Software Foundation, Inc. + Copyright (C) 1985, 2001-2013 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -38,7 +38,7 @@ along with GNU Emacs. If not, see . */ could include embedded null characters. . It signals an error if the length of the formatted string is about to - overflow MOST_POSITIVE_FIXNUM, to avoid producing strings longer than what + overflow ptrdiff_t or size_t, to avoid producing strings longer than what Emacs can handle. OTOH, this function supports only a small subset of the standard C formatted @@ -102,7 +102,6 @@ along with GNU Emacs. If not, see . */ #include #include -#include #include #include #include @@ -114,10 +113,6 @@ along with GNU Emacs. If not, see . */ another macro. */ #include "character.h" -#ifndef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 308 /* IEEE double */ -#endif - /* Generate output from a format-spec FORMAT, terminated at position FORMAT_END. (*FORMAT_END is not part of the format, but must exist and be readable.) @@ -526,7 +521,10 @@ evxprintf (char **buf, ptrdiff_t *bufsize, if (nbytes < *bufsize - 1) return nbytes; if (*buf != nonheapbuf) - xfree (*buf); + { + xfree (*buf); + *buf = NULL; + } *buf = xpalloc (NULL, bufsize, 1, bufsize_max, 1); } }