aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/src/eval.c b/src/eval.c
index e722b53fb72..f2407cede31 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1951,35 +1951,11 @@ verror (const char *m, va_list ap)
1951 char buf[4000]; 1951 char buf[4000];
1952 ptrdiff_t size = sizeof buf; 1952 ptrdiff_t size = sizeof buf;
1953 ptrdiff_t size_max = STRING_BYTES_BOUND + 1; 1953 ptrdiff_t size_max = STRING_BYTES_BOUND + 1;
1954 char const *m_end = m + strlen (m);
1955 char *buffer = buf; 1954 char *buffer = buf;
1956 ptrdiff_t used; 1955 ptrdiff_t used;
1957 Lisp_Object string; 1956 Lisp_Object string;
1958 1957
1959 while (1) 1958 used = evxprintf (&buffer, &size, buf, size_max, m, ap);
1960 {
1961 va_list ap_copy;
1962 va_copy (ap_copy, ap);
1963 used = doprnt (buffer, size, m, m_end, ap_copy);
1964 va_end (ap_copy);
1965
1966 /* Note: the -1 below is because `doprnt' returns the number of bytes
1967 excluding the terminating null byte, and it always terminates with a
1968 null byte, even when producing a truncated message. */
1969 if (used < size - 1)
1970 break;
1971 if (size <= size_max / 2)
1972 size *= 2;
1973 else if (size < size_max)
1974 size = size_max;
1975 else
1976 break; /* and leave the message truncated */
1977
1978 if (buffer != buf)
1979 xfree (buffer);
1980 buffer = (char *) xmalloc (size);
1981 }
1982
1983 string = make_string (buffer, used); 1959 string = make_string (buffer, used);
1984 if (buffer != buf) 1960 if (buffer != buf)
1985 xfree (buffer); 1961 xfree (buffer);