(Fencode_time): ... adjusted user.
(Fset_time_zone_rule): Use decode_time_zone.
+ * editfns.c (make_buffer_string_both): If requested range intersects
+ the gap, don't move the latter but copy in two regions, thus avoiding
+ unnecessary relocation of buffer data.
+
2015-01-14 Paul Eggert <eggert@cs.ucla.edu>
Use bool for boolean in xmenu.c, xml.c
ptrdiff_t end, ptrdiff_t end_byte, bool props)
{
Lisp_Object result, tem, tem1;
+ ptrdiff_t beg0, end0, beg1, end1, size;
- if (start < GPT && GPT < end)
- move_gap_both (start, start_byte);
+ if (start_byte < GPT_BYTE && GPT_BYTE < end_byte)
+ {
+ /* Two regions, before and after the gap. */
+ beg0 = start_byte;
+ end0 = GPT_BYTE;
+ beg1 = GPT_BYTE + GAP_SIZE - BEG_BYTE;
+ end1 = end_byte + GAP_SIZE - BEG_BYTE;
+ }
+ else
+ {
+ /* The only region. */
+ beg0 = start_byte;
+ end0 = end_byte;
+ beg1 = -1;
+ end1 = -1;
+ }
if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
else
result = make_uninit_string (end - start);
- memcpy (SDATA (result), BYTE_POS_ADDR (start_byte), end_byte - start_byte);
+
+ size = end0 - beg0;
+ memcpy (SDATA (result), BYTE_POS_ADDR (beg0), size);
+ if (beg1 != -1)
+ memcpy (SDATA (result) + size, BEG_ADDR + beg1, end1 - beg1);
/* If desired, update and copy the text properties. */
if (props)