APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1514544619 0
# Fri Dec 29 10:50:19 2017 +0000
# Node ID 27b87c12a3aba5014f70dcb1b0ebb884c302f6fe
# Parent 24f04bada33d560caea25b9f26471e885d17c1a9
Avoid begin_gc_forbidden(), end_gc_forbidden(), doprnt.c
src/ChangeLog addition:
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* doprnt.c (emacs_vsprintf_string):
* doprnt.c (emacs_vasprintf):
There is no need to forbid GC in these functions, the resizing
buffer output stream cannot GC and continue, nor can
write_fmt_string_lisp_va().
Jerry James just showed a backtrace where forbidding GC here
actually caused XEmacs to crash, early in startup when
specpdl_size was unitialised and begin_gc_forbidden() did an
infinite loop.
diff -r 24f04bada33d -r 27b87c12a3ab src/ChangeLog
--- a/src/ChangeLog Fri Dec 29 10:25:26 2017 +0000
+++ b/src/ChangeLog Fri Dec 29 10:50:19 2017 +0000
@@ -1,3 +1,15 @@
+2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * doprnt.c (emacs_vsprintf_string):
+ * doprnt.c (emacs_vasprintf):
+ There is no need to forbid GC in these functions, the resizing
+ buffer output stream cannot GC and continue, nor can
+ write_fmt_string_lisp_va().
+ Jerry James just showed a backtrace where forbidding GC here
+ actually caused XEmacs to crash, early in startup when
+ specpdl_size was unitialised and begin_gc_forbidden() did an
+ infinite loop.
+
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* print.c (output_string):
diff -r 24f04bada33d -r 27b87c12a3ab src/doprnt.c
--- a/src/doprnt.c Fri Dec 29 10:25:26 2017 +0000
+++ b/src/doprnt.c Fri Dec 29 10:50:19 2017 +0000
@@ -3125,17 +3125,15 @@
/* vsprintf()-like replacement. Arguments are interpreted as C
objects--doubles, char *s, EMACS_INTs, etc. Returns a Lisp string. Data
- from Lisp strings is OK because we explicitly inhibit GC. */
+ from Lisp strings is OK because we cannot GC. */
Lisp_Object
emacs_vsprintf_string (const CIbyte *format, va_list vargs)
{
Lisp_Object stream = make_resizing_buffer_output_stream (), obj;
- int count = begin_gc_forbidden ();
write_fmt_string_va (stream, format, vargs);
obj = resizing_buffer_to_lisp_string (XLSTREAM (stream));
Lstream_delete (XLSTREAM (stream));
- end_gc_forbidden (count);
return obj;
}
@@ -3157,14 +3155,13 @@
/* vasprintf() implementation. Arguments are interpreted as C
objects--doubles, char *s, EMACS_INTs, etc. Data from Lisp strings is OK
- because we explicitly inhibit GC. Returns length (not including the
+ because we cannot GC. Returns length (not including the
terminating zero). Stores a pointer to be freed with free() into
*RETVAL_OUT. */
Bytecount
emacs_vasprintf (Ibyte **retval_out, const CIbyte *format, va_list vargs)
{
Lisp_Object stream = make_resizing_buffer_output_stream ();
- int count = begin_gc_forbidden ();
Bytecount len;
write_fmt_string_va (stream, format, vargs);
@@ -3176,8 +3173,6 @@
(*retval_out)[len] = '\0';
Lstream_delete (XLSTREAM (stream));
- end_gc_forbidden (count);
-
return len;
}
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)
Show replies by date