@@ -124,7 +124,7 @@ static void print_vector(Scheme_Object *vec, int notdisplay, int compact,
124
124
static void print_char (Scheme_Object * chobj , int notdisplay , PrintParams * pp );
125
125
static char * print_to_string (Scheme_Object * obj , intptr_t * volatile len , int write ,
126
126
Scheme_Object * port , intptr_t maxl ,
127
- Scheme_Object * qq_depth );
127
+ Scheme_Object * qq_depth , int * _release_to_quick );
128
128
129
129
static void custom_write_struct (Scheme_Object * s , Scheme_Hash_Table * ht ,
130
130
Scheme_Marshal_Tables * mt ,
@@ -384,7 +384,7 @@ static void *print_to_string_k(void)
384
384
p -> ku .k .p2 = NULL ;
385
385
p -> ku .k .p3 = NULL ;
386
386
387
- return (void * )print_to_string (obj , len , iswrite , NULL , maxl , qq_depth );
387
+ return (void * )print_to_string (obj , len , iswrite , NULL , maxl , qq_depth , NULL );
388
388
}
389
389
390
390
char * scheme_write_to_string_w_max (Scheme_Object * obj , intptr_t * len , intptr_t maxl )
@@ -956,7 +956,7 @@ static char *
956
956
print_to_string (Scheme_Object * obj ,
957
957
intptr_t * volatile len , int write ,
958
958
Scheme_Object * port , intptr_t maxl ,
959
- Scheme_Object * qq_depth )
959
+ Scheme_Object * qq_depth , int * _release_to_quick )
960
960
{
961
961
Scheme_Hash_Table * ht ;
962
962
Scheme_Hash_Table * uq_ht ;
@@ -1111,8 +1111,14 @@ print_to_string(Scheme_Object *obj,
1111
1111
1112
1112
params .inspector = NULL ;
1113
1113
1114
- if (port && !quick_print_buffer )
1115
- quick_print_buffer = ca ;
1114
+ if (_release_to_quick ) {
1115
+ * _release_to_quick = 0 ;
1116
+ if (params .print_buffer != ca ) {
1117
+ if (!quick_print_buffer )
1118
+ quick_print_buffer = ca ;
1119
+ } else
1120
+ * _release_to_quick = 1 ;
1121
+ }
1116
1122
1117
1123
return params .print_buffer ;
1118
1124
}
@@ -1124,16 +1130,20 @@ print_to_port(char *name, Scheme_Object *obj, Scheme_Object *port, int notdispla
1124
1130
Scheme_Output_Port * op ;
1125
1131
char * str ;
1126
1132
intptr_t len ;
1133
+ int rel ;
1127
1134
1128
1135
op = scheme_output_port_record (port );
1129
1136
if (op -> closed )
1130
1137
scheme_raise_exn (MZEXN_FAIL , "%s: output port is closed\n"
1131
1138
" port: %V" ,
1132
1139
name , port );
1133
1140
1134
- str = print_to_string (obj , & len , notdisplay , port , maxl , qq_depth );
1141
+ str = print_to_string (obj , & len , notdisplay , port , maxl , qq_depth , & rel );
1135
1142
1136
1143
scheme_write_byte_string (str , len , port );
1144
+
1145
+ if (rel && !quick_print_buffer )
1146
+ quick_print_buffer = str ;
1137
1147
}
1138
1148
1139
1149
static void print_this_string (PrintParams * pp , const char * str , int offset , int autolen )
@@ -2850,10 +2860,13 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht,
2850
2860
if (pp -> print_syntax ) {
2851
2861
intptr_t slen ;
2852
2862
char * str ;
2863
+ int rel ;
2853
2864
print_utf8_string (pp , " " , 0 , 1 );
2854
2865
str = print_to_string (scheme_syntax_to_datum ((Scheme_Object * )stx , 0 , NULL ),
2855
- & slen , 1 , NULL , pp -> print_syntax , NULL );
2866
+ & slen , 1 , NULL , pp -> print_syntax , NULL , & rel );
2856
2867
print_utf8_string (pp , str , 0 , slen );
2868
+ if (rel && !quick_print_buffer )
2869
+ quick_print_buffer = str ;
2857
2870
}
2858
2871
print_utf8_string (pp , ">" , 0 , 1 );
2859
2872
} else {
0 commit comments