X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Finsdel.c;h=a85481ce6dc2a9b853b2bac891a6df1de9d16e39;hp=f516263fd7277023f06e4bd31a9218eaef23ba6d;hb=fc475e6669a613cd6d98eb5511c749a23b63c7ac;hpb=669565bfdc5d704dfb1d5ac1a0ec01fb3615a1ae diff --git a/src/insdel.c b/src/insdel.c index f516263..a85481c 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2992,22 +2992,20 @@ buffer_replace_char (struct buffer *buf, Bufpos pos, Emchar ch, /* 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; + 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); - bi_ind = bufpos_to_bytind (buf, pos); - bi_len = bufpos_to_bytind (buf, pos + length) - bi_ind; - - 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; @@ -3039,6 +3037,19 @@ make_string_from_buffer (struct buffer *buf, Bufpos pos, Charcount length) 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) {