Bytecount old_gap_size;
/* If we have to get more space, get enough to last a while. We use
- a geometric progession that saves on realloc space. */
+ a geometric progression that saves on realloc space. */
increment += 2000 + ((BI_BUF_Z (buf) - BI_BUF_BEG (buf)) / 8);
if (increment > BUF_END_GAP_SIZE (buf))
/* Make a string from a buffer. This needs to take into account the gap,
and add any necessary extents from the buffer. */
-Lisp_Object
-make_string_from_buffer (struct buffer *buf, Bufpos pos, Charcount length)
+static Lisp_Object
+make_string_from_buffer_1 (struct buffer *buf, Bufpos pos, Charcount length,
+ int no_extents)
{
/* This function can GC */
- Lisp_Object val;
- struct gcpro gcpro1;
- Bytind bi_ind;
- Bytecount bi_len;
-
- bi_ind = bufpos_to_bytind (buf, pos);
- bi_len = bufpos_to_bytind (buf, pos + length) - bi_ind;
+ Bytind bi_ind = bufpos_to_bytind (buf, pos);
+ Bytecount bi_len = bufpos_to_bytind (buf, pos + length) - bi_ind;
+ Lisp_Object val = make_uninit_string (bi_len);
- val = make_uninit_string (bi_len);
+ struct gcpro gcpro1;
GCPRO1 (val);
- add_string_extents (val, buf, bi_ind, bi_len);
+ if (!no_extents)
+ add_string_extents (val, buf, bi_ind, bi_len);
{
Bytecount len1 = BI_BUF_GPT (buf) - bi_ind;
return val;
}
+Lisp_Object
+make_string_from_buffer (struct buffer *buf, Bufpos pos, Charcount length)
+{
+ return make_string_from_buffer_1 (buf, pos, length, 0);
+}
+
+Lisp_Object
+make_string_from_buffer_no_extents (struct buffer *buf, Bufpos pos,
+ Charcount length)
+{
+ return make_string_from_buffer_1 (buf, pos, length, 1);
+}
+
void
barf_if_buffer_read_only (struct buffer *buf, Bufpos from, Bufpos to)
{
}
}
-int
+Charcount
convert_bufbyte_string_into_emchar_string (CONST Bufbyte *str, Bytecount len,
Emchar *arr)
{